/* Rosenau-Universum – gemeinsames Erscheinungsbild
   Dunkler Raum, farbige Planeten, sonst zurückhaltend: die Grafik trägt,
   die Typografie hält sich heraus. */

:root {
  --raum-tief:  #060b1e;
  --raum:       #0c1330;
  --raum-hoch:  #131c44;
  --stern:      #edf2ff;
  --text:       #a3b4e2;
  --text-leise: #7285b6;
  --gold:       #ffc24d;
  --gruen:      #5fd6a4;
  --rot:        #ff7a6b;
  --kante:      rgba(150, 175, 255, .16);
  --kante-hell: rgba(180, 200, 255, .34);

  --anzeige: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --lauf:    "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
/* Muss vor allen display-Regeln stehen: sonst hebt etwa
   "button { display: inline-block }
" das hidden-Attribut auf. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--raum-tief);
  color: var(--text);
  font-family: var(--lauf);
  font-size: 17px;
  line-height: 1.6;
}
/* Sternenhimmel: liegt fest hinter allem */
body::before {
  content: "";
  position: fixed; inset: 0;
  background: var(--raum-tief) url("sterne.svg") center / cover no-repeat;
  z-index: -2;
}
body::after {
  content: "";
  position: fixed; inset: 0;
  background: radial-gradient(ellipse 80% 55% at 50% -10%, rgba(90,120,255,.20), transparent 70%);
  z-index: -1;
  pointer-events: none;
}
h1, h2, h3, .anz, button, input, label {
  font-family: var(--anzeige);
}
h1, h2, h3 { margin: 0; line-height: 1.15; color: var(--stern); font-weight: 600; }
a { color: var(--stern); }
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}
.blatt { max-width: 66rem; margin: 0 auto; padding: 0 1.25rem; }
.eng { max-width: 30rem; }
/* ==================================================================
   Anmeldung
   ================================================================== */

.tor {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2rem 1.25rem 4rem;
  text-align: center;
}
/* Wichtig fürs Handy: In einem zentrierten Spalten-Flex schrumpfen Kinder
   nicht von selbst unter ihre Inhaltsbreite (min-width: auto). Ein zu
   breites Kind steht dann mittig über – links genauso wie rechts. Die
   Namensliste ist bis 40rem breit; auf einem schmalen Handy schob das
   die linke Spalte aus dem Bild, und wer dort stand, war unsichtbar.
   Bei der Lehrperson mit einem einzigen Knopf traf es genau diesen. */
.tor > * { max-width: 100%; min-width: 0; }
/* .tor .sonne stammt aus der Fassung mit dem alten Wappenplaneten.
   Sie setzte Breite und Höhe fest – das verzerrte jedes Bild mit anderem
   Seitenverhältnis. Die Grösse regelt jetzt .tor .logo-voll allein. */
.tor .sonne { width: 190px; margin-bottom: -.4rem; }
.tor h1 {
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 700;
  letter-spacing: -.01em;
}
.tor .unter { color: var(--text); margin: .5rem 0 2.2rem; max-width: 26rem; }
.pinfeld {
  width: 100%; max-width: 20rem;
  background: rgba(19, 28, 68, .72);
  border: 1px solid var(--kante);
  border-radius: 14px;
  padding: 1.6rem 1.4rem 1.4rem;
  backdrop-filter: blur(6px);
}
.pinfeld label {
  display: block; font-size: .92rem; color: var(--text);
  margin-bottom: .55rem; font-weight: 500;
}
.pinfeld input {
  width: 100%;
  font-family: var(--anzeige);
  font-size: 1.9rem; font-weight: 600;
  letter-spacing: .34em; text-indent: .34em;
  text-align: center;
  padding: .6rem .5rem;
  color: var(--stern);
  background: rgba(6, 11, 30, .8);
  border: 1px solid var(--kante-hell);
  border-radius: 8px;
}
.pinfeld input::placeholder { color: #3f4f7f; letter-spacing: .3em; }
.pinfeld button { width: 100%; margin-top: .9rem; }
.tormeldung {
  margin: 1rem auto 0; max-width: 20rem;
  color: var(--rot); font-family: var(--anzeige); font-size: .95rem;
}
.torhilfe { margin-top: 1.6rem; font-size: .9rem; color: var(--text-leise); max-width: 22rem; }
/* ==================================================================
   Knöpfe
   ================================================================== */

button, .knopf {
  font-family: var(--anzeige); font-size: 1rem; font-weight: 600;
  padding: .7rem 1.3rem;
  color: #1b1405;
  background: linear-gradient(180deg, #ffd678, var(--gold));
  border: 0; border-radius: 8px;
  cursor: pointer; text-decoration: none; display: inline-block;
}
button.leise, .knopf.leise {
  background: transparent; color: var(--stern);
  border: 1px solid var(--kante-hell);
}
/* ==================================================================
   Kopfzeile im angemeldeten Zustand
   ================================================================== */

.kopf {
  display: flex; align-items: center; gap: 1rem;
  flex-wrap: wrap; justify-content: space-between;
  padding: 1.4rem 0 1rem;
  border-bottom: 1px solid var(--kante);
}
.kopf .marke { display: flex; align-items: center; gap: .8rem; }
.kopf .marke .planet {
  width: 54px; height: 54px;
  filter: drop-shadow(0 0 12px rgba(150, 195, 255, .35));
}
.kopf .marke b {
  font-family: var(--anzeige); font-size: 1.35rem; font-weight: 700;
  color: var(--stern); display: block; line-height: 1.1;
}
.kopf .marke span { font-size: .88rem; color: var(--text-leise); }
.kopf .wer { text-align: right; font-size: .9rem; }
.kopf .wer b { color: var(--stern); font-family: var(--anzeige); }
.kopf .wer a { color: var(--text); }
/* ==================================================================
   Das Sonnensystem: die Planetenkacheln
   ================================================================== */

.einstieg { margin: 2.4rem 0 .5rem; max-width: 38rem; }
.einstieg h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 700; }
.einstieg p { margin: .6rem 0 0; }
.system {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.3rem;
  align-items: stretch;
  margin: 2.4rem 0 4rem;
  list-style: none; padding: 0;
}
.welt {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  height: 100%;
  padding: 1.7rem 1.3rem 1.6rem;
  border: 1px solid var(--kante);
  border-radius: 16px;
  background: rgba(19, 28, 68, .48);
  text-decoration: none; color: inherit;
  transition: border-color .18s, background .18s, transform .18s;
}
.welt:focus-visible {
  border-color: var(--kante-hell);
  background: rgba(28, 40, 90, .62);
  transform: translateY(-4px);
}
/* Umlaufbahn hinter dem Planeten */
.scheibe { position: relative; width: 168px; height: 168px; display: grid; place-items: center; }
.scheibe::before {
  content: "";
  position: absolute; inset: 6px;
  border: 1px dashed rgba(160, 185, 255, .22);
  border-radius: 50%;
  transform: rotate(-18deg) scaleY(.42);
}
.scheibe .planet {
  width: 136px; height: 136px; position: relative;
  transition: transform .25s, filter .25s;
  /* Lichthof: bei den Bildern nicht eingebaut, darum hier */
  filter: drop-shadow(0 0 18px rgba(150, 190, 255, .30))
          drop-shadow(0 6px 14px rgba(0, 0, 0, .45));
}
.welt:focus-visible .scheibe .planet {
  filter: drop-shadow(0 0 26px rgba(175, 210, 255, .48))
          drop-shadow(0 8px 18px rgba(0, 0, 0, .5));
}
.welt:focus-visible .scheibe .planet { transform: scale(1.09); }
.welt .name {
  font-family: var(--anzeige); font-weight: 600; font-size: 1.22rem;
  color: var(--stern); margin-top: .7rem;
}
.welt .kurz {
  font-family: var(--anzeige); font-size: .78rem; letter-spacing: .06em;
  color: var(--gold); margin-top: .15rem;
}
.welt .text { font-size: .95rem; margin-top: .55rem; color: var(--text); }
.welt .stand {
  margin-top: .8rem; font-family: var(--anzeige); font-size: .85rem;
  color: var(--text-leise);
}
.welt .stand b { color: var(--gruen); }
.welt.ruht { pointer-events: none; }
.welt.ruht .planet { filter: grayscale(.55) brightness(.7) drop-shadow(0 4px 10px rgba(0,0,0,.45)); }
.welt.ruht .name { color: var(--text-leise); }
.welt.ruht .kurz { color: var(--text-leise); }
.welt.ruht .text { color: var(--text-leise); opacity: .85; }
/* Hervorgehobene Welt: wärmerer Rand, leichter Schimmer.
   Bewusst zurückhaltend – sie soll auffallen, nicht schreien. */
.welt.wichtig {
  border-color: rgba(255, 194, 77, .42);
  background:
    linear-gradient(180deg, rgba(255, 194, 77, .07), transparent 55%),
    rgba(19, 28, 68, .48);
  box-shadow: 0 0 0 1px rgba(255, 194, 77, .10), 0 10px 30px rgba(0, 0, 0, .35);
}
.welt.wichtig:focus-visible {
  border-color: rgba(255, 194, 77, .70);
  box-shadow: 0 0 0 1px rgba(255, 194, 77, .20), 0 14px 36px rgba(0, 0, 0, .45);
}
.welt.wichtig .kurz { color: var(--gold); }
/* Logo */
.logo { display: block; height: auto; }
.marke .logo-zeichen { width: 52px; }
.tor .logo-voll {
  width: min(300px, 62vw);        /* quadratisches Abzeichen, nicht breit */
  margin: 0 auto 1.4rem;
  filter: drop-shadow(0 0 46px rgba(90, 140, 255, .40));
}
.verborgen {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
/* Reine Platzhalter: erkennbar, aber deutlich im Hintergrund.
   Gestrichelter Rand statt Fläche – das liest sich als «hier ist noch Platz». */
.welt.leer {
  border-style: dashed;
  border-color: rgba(140, 165, 235, .22);
  background: rgba(19, 28, 68, .18);
  justify-content: center;
}
.welt.leer .scheibe { width: 112px; height: 112px; }
.welt.leer .scheibe::before { display: none; }
.welt.leer .planet {
  width: 84px; height: 84px;
  filter: grayscale(.35) brightness(.72);
  opacity: .72;
}
.welt.leer .name {
  color: var(--text-leise); font-weight: 500; font-size: .98rem; margin-top: .5rem;
}
.welt.leer .text { font-size: .85rem; color: var(--text-leise); opacity: .8; }
/* Leichte Staffelung, damit es nach Umlaufbahn und nicht nach Tabelle aussieht */
@media (min-width: 52rem) {
  .system > :nth-child(3n+2) { transform: translateY(2rem); }
  .system > :nth-child(3n+2) .welt:hover,
  .system > :nth-child(3n+2) .welt:focus-visible { transform: translateY(-4px); }
}
/* ==================================================================
   Steuerpult der Lehrperson
   ================================================================== */

.pult { margin: 2rem 0 3rem; }
.pultreihe {
  display: grid; grid-template-columns: 3.4rem 1fr auto; gap: 1rem;
  align-items: center;
  padding: .9rem 1rem;
  border: 1px solid var(--kante); border-radius: 12px;
  background: rgba(19, 28, 68, .42);
  margin-bottom: .6rem;
}
.pultreihe .planet { width: 3.4rem; height: 3.4rem; }
.pultreihe b { font-family: var(--anzeige); color: var(--stern); font-size: 1.05rem; }
.pultreihe p { margin: .1rem 0 0; font-size: .9rem; color: var(--text-leise); }
.pultreihe .verweise { display: flex; gap: .5rem; flex-wrap: wrap; }
.pultreihe .verweise a {
  font-family: var(--anzeige); font-size: .85rem; text-decoration: none;
  padding: .35rem .75rem; border: 1px solid var(--kante-hell); border-radius: 6px;
  color: var(--stern); white-space: nowrap;
}
.tafel {
  border: 1px solid var(--kante); border-radius: 14px;
  background: rgba(19, 28, 68, .42);
  padding: 1.3rem 1.4rem; margin: 1.2rem 0;
}
.tafel h2 { font-size: 1.15rem; margin-bottom: .8rem; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--kante); }
th { font-family: var(--anzeige); font-size: .82rem; color: var(--text-leise); font-weight: 600; }
td { color: var(--text); }
tr:last-child td { border-bottom: 0; }
.marke-klein {
  display: inline-block; font-family: var(--anzeige); font-size: .78rem;
  padding: .1rem .5rem; border: 1px solid var(--kante-hell);
  border-radius: 5px; color: var(--text);
}
.fuss {
  margin: 3rem 0 2rem; padding-top: 1rem;
  border-top: 1px solid var(--kante);
  font-family: var(--anzeige); font-size: .84rem; color: var(--text-leise);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
@media (max-width: 34rem) {
body { font-size: 16px; }
.pultreihe { grid-template-columns: 2.6rem 1fr; }
.pultreihe .planet { width: 2.6rem; height: 2.6rem; }
.pultreihe .verweise { grid-column: 1 / -1; }
}
@media (max-width: 62rem) {
.system { grid-template-columns: repeat(2, 1fr); }
.system > :nth-child(3n+2) { transform: none; }
.system > :nth-child(2n) { transform: translateY(1.6rem); }
}
@media (max-width: 38rem) {
.system { grid-template-columns: 1fr; gap: 1rem; }
.system > :nth-child(2n) { transform: none; }
.scheibe { width: 132px; height: 132px; }
.scheibe .planet { width: 106px; height: 106px; }
}
@media (prefers-reduced-motion: reduce) {
* { transition: none !important; animation: none !important; }
.welt:focus-visible { transform: none; }
.system > :nth-child(3n+2) { transform: none; }
}
/* ============ Anmeldung: Namensliste und Nummernpad ============ */

.klassenwahl { display: flex; justify-content: center; gap: .5rem; margin: 0 0 1.2rem; }
.klasse {
  background: transparent; color: var(--text);
  border: 1px solid var(--kante); border-radius: 999px;
  padding: .4rem 1.1rem; font-size: .95rem; font-weight: 600;
}
.klasse.aktiv {
  background: linear-gradient(180deg, #ffd678, var(--gold));
  color: #1b1405; border-color: transparent;
}
.namen {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: .5rem;
  max-width: 40rem; margin: 0 auto 1rem;
  max-height: 46vh; overflow-y: auto;
  padding: .2rem;
}
.namen .name {
  background: rgba(19, 28, 68, .55);
  color: var(--stern);
  border: 1px solid var(--kante);
  border-radius: 10px;
  padding: .75rem .6rem;
  font-size: 1rem; font-weight: 500;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.begruessung { font-family: var(--anzeige); font-size: 1.35rem; color: var(--stern); margin: 0 0 .2rem; }
.begruessung b { font-weight: 700; }
.pinpunkte { display: flex; justify-content: center; gap: .7rem; margin: 1.3rem 0 1.5rem; }
.pinpunkte i {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--kante-hell);
}
.pinpunkte i.voll { background: var(--gold); border-color: var(--gold); }
.nummernpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  width: min(19rem, 82vw);
  margin: 0 auto 1.2rem;
}
.taste {
  background: rgba(19, 28, 68, .6);
  color: var(--stern);
  border: 1px solid var(--kante-hell);
  border-radius: 12px;
  padding: 1rem 0;
  font-size: 1.55rem; font-weight: 600;
  line-height: 1;
}
.taste:active { transform: translateY(1px); }
.taste.ok {
  background: linear-gradient(180deg, #ffd678, var(--gold));
  color: #1b1405; border-color: transparent;
}
.taste.leise { background: transparent; color: var(--text); }
.zurueck {
  background: none; border: 0; color: var(--text);
  font-size: .95rem; text-decoration: underline; padding: .4rem;
}
@media (max-width: 26rem) {
.namen { grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); }
.namen .name { font-size: .92rem; padding: .65rem .4rem; }
.taste { font-size: 1.35rem; padding: .85rem 0; }
}

/* ------------------------------------------------------------------
   Hover nur für echte Zeigegeräte.
   Auf iPad und Handy bleibt ein Hover-Zustand sonst nach dem Antippen
   kleben – die Kachel sieht dann dauerhaft "angefasst" aus.
   ------------------------------------------------------------------ */
@media (hover: hover) and (pointer: fine) {
  button:hover, .knopf:hover { background: linear-gradient(180deg, #ffe19a, #ffcd6a); }
  button.leise:hover, .knopf.leise:hover { background: rgba(150, 175, 255, .12); }
  .welt:hover {
    border-color: var(--kante-hell);
    background: rgba(28, 40, 90, .62);
    transform: translateY(-4px);
  }
  .welt:hover .scheibe .planet {
    filter: drop-shadow(0 0 26px rgba(175, 210, 255, .48))
            drop-shadow(0 8px 18px rgba(0, 0, 0, .5));
  }
  .welt:hover .scheibe .planet { transform: scale(1.09); }
  .welt.wichtig:hover {
    border-color: rgba(255, 194, 77, .70);
    box-shadow: 0 0 0 1px rgba(255, 194, 77, .20), 0 14px 36px rgba(0, 0, 0, .45);
  }
  .pultreihe .verweise a:hover { background: rgba(150, 175, 255, .14); }
  /* aus @media (prefers-reduced-motion: reduce) */
  .welt:hover { transform: none; }
  .namen .name:hover { background: rgba(40, 58, 122, .75); border-color: var(--kante-hell); }
  .taste:hover { background: rgba(46, 66, 135, .8); }
  .zurueck:hover { color: var(--stern); }
}


/* ==================================================================
   Tablets und Touchbedienung

   Die SuS arbeiten auf iPads. Vier Dinge gehen dort sonst schief:
   – Eingabefelder unter 16px lösen bei Safari einen Zoomsprung aus,
     nach dem die Seite verrutscht ist
   – Schaltflächen unter etwa 44px sind mit dem Finger schlecht zu treffen
   – der graue Blitz beim Antippen wirkt wie ein Fehler
   – 100vh rechnet die Adressleiste mit, der Inhalt wird abgeschnitten
   ================================================================== */

/* Kein Zoomsprung beim Antippen eines Feldes. 16px ist die Grenze. */
input, select, textarea, button {
  font-size: max(16px, 1rem);
}

/* Kein grauer Blitz, kein Text-Markieren beim Tippen auf Bedienelemente */
a, button, .taste, .namen .name, .klasse, .option, .welt, .fach, .ue, .mond, label {
  -webkit-tap-highlight-color: transparent;
}
button, .knopf, .taste, .namen .name, .klasse {
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;          /* verhindert die 300ms-Verzögerung */
}

/* Planeten und Logo nicht versehentlich als Bild "aufhalten" */
.planet, .logo {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

/* Volle Höhe ohne die iOS-Adressleiste mitzurechnen */
@supports (height: 100dvh) {
  .kopf ~ *, .tor { min-height: auto; }
  body { min-height: 100dvh; }
}

/* Randbereiche moderner Geräte freihalten (Home-Indikator, abgerundete Ecken) */
.blatt {
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
}
.fuss { padding-bottom: env(safe-area-inset-bottom); }

@media (pointer: coarse) {

  /* Fingergerechte Mindestgrössen. 44px ist der Richtwert von Apple. */
  button, .knopf, .klasse, .zurueck {
    min-height: 44px;
    padding-top: .7rem; padding-bottom: .7rem;
  }
  .namen .name { min-height: 52px; padding: .85rem .7rem; font-size: 1.02rem; }
  .taste { min-height: 64px; font-size: 1.6rem; }

  /* Auswahlfelder: die ganze Zeile ist antippbar, nicht nur der Punkt */
  .option, fieldset.wahl label {
    min-height: 48px; padding: .85rem 1rem; align-items: center;
  }
  .option input, fieldset.wahl input {
    width: 22px; height: 22px; margin-top: 0; flex: none;
  }

  /* Auswahllisten und Textfelder grösser */
  select, input[type=text], input[type=password], input[type=number] {
    min-height: 46px;
  }
  .paar select { min-height: 48px; }

  /* Verweise in Kopf- und Fusszeilen brauchen mehr Fläche.
     Achtung: Die Kopfzeile heisst .kopf mit .marke und .wer – nicht .weltkopf. */
  .kopf .wer a, .kopf .marke a, .leiste a, .fuss a,
  .leserfuss a, .weiter a, .zuletzt a, .werkstatt a {
    display: inline-flex; align-items: center;
    min-height: 44px; padding: .3rem .25rem;
  }
  .kopf .marke a { min-height: 48px; }

  /* Listen mit Schwung scrollen */
  .namen, .nussliste, .satzliste { -webkit-overflow-scrolling: touch; }
  .namen { max-height: 52vh; }
}

/* iPad hochkant: zwei Spalten sind angenehmer als drei gequetschte */
@media (min-width: 45rem) and (max-width: 64rem) and (pointer: coarse) {
  .system { grid-template-columns: repeat(2, 1fr); }
  .system > :nth-child(3n+2) { transform: none; }
  .system > :nth-child(2n) { transform: translateY(1.6rem); }
  .faecher { grid-template-columns: repeat(2, 1fr); }
}
