/* Farben angelehnt an ein dunkles Code-Editor-Thema */
:root {
  --hintergrund: #0d1117;
  --fenster: #161b22;
  --leiste: #1f242c;
  --rahmen: #30363d;
  --text: #e6edf3;
  --text-leise: #8b949e;       /* Kommentare */
  --schluesselwort: #ff7b72;   /* rot */
  --funktion: #d2a8ff;         /* lila */
  --variable: #79c0ff;         /* blau */
  --zeichenkette: #a5d6ff;     /* hellblau */
  --ok: #7ee787;               /* grün */
  --akzent: #8957e5;           /* Button, passend zu "Purples" */
  --akzent-hell: #a371f7;
  --schrift: "JetBrains Mono", Menlo, Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

/* Ausgeblendete Ansichten wirklich ausblenden (sonst gewinnt z. B. display: flex) */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  padding: 24px 16px;
  min-height: 100vh;
  background: var(--hintergrund);
  color: var(--text);
  font-family: var(--schrift);
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- Editor-Fenster ---------- */

.fenster {
  max-width: 1180px;
  margin: 0 auto;
  background: var(--fenster);
  border: 1px solid var(--rahmen);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.fenster-leiste {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--leiste);
  border-bottom: 1px solid var(--rahmen);
}

.punkt {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.punkt.rot { background: #ff5f57; }
.punkt.gelb { background: #febc2e; }
.punkt.gruen { background: #28c840; }

.fenster-titel {
  margin-left: 10px;
  padding: 2px 10px;
  font-size: 13px;
  color: var(--text-leise);
  background: var(--fenster);
  border: 1px solid var(--rahmen);
  border-radius: 6px;
}

.fenster-inhalt {
  padding: 28px clamp(16px, 4vw, 40px) 36px;
}

/* ---------- Bausteine im Code-Stil ---------- */

.kommentar { color: var(--text-leise); }
.schluesselwort { color: var(--schluesselwort); }
.funktion { color: var(--funktion); }
.variable { color: var(--variable); }
.text { color: var(--zeichenkette); }

/* Blinkender Cursor hinter Überschriften */
.cursor {
  color: var(--akzent-hell);
  animation: blinken 1.1s steps(1) infinite;
}
@keyframes blinken {
  50% { opacity: 0; }
}

/* Ausgabezeilen im Terminal-Stil */
.log {
  margin: 0;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-befehl { color: var(--text); }
.log-kommentar { color: var(--text-leise); }
.log-ok { color: var(--ok); }
.log-fehler { color: var(--schluesselwort); }

/* ---------- Buttons ---------- */

.button-haupt {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: white;
  background: var(--akzent);
  border: 1px solid var(--akzent-hell);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.button-haupt:hover:not(:disabled) { background: var(--akzent-hell); }
.button-haupt:active:not(:disabled) { transform: translateY(1px); }
.button-haupt:focus-visible { outline: 2px solid var(--zeichenkette); outline-offset: 2px; }
.button-haupt:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Zweitrangige Buttons: nur Rahmen */
.button-zweit {
  padding: 9px 16px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--rahmen);
  border-radius: 8px;
  cursor: pointer;
}
.button-zweit:hover:not(:disabled) { border-color: var(--akzent-hell); color: white; }
.button-zweit:focus-visible { outline: 2px solid var(--zeichenkette); outline-offset: 2px; }
.button-zweit:disabled { opacity: 0.4; cursor: not-allowed; }
.button-zweit.gefahr { color: var(--schluesselwort); }
.button-zweit.gefahr:hover { border-color: var(--schluesselwort); color: var(--schluesselwort); }

.button-reihe {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

/* ---------- Ansicht 1: Start ---------- */

.start,
.rechnen {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

h1 {
  margin: 4px 0 8px;
  font-size: clamp(2.2rem, 7vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.beschreibung {
  margin: 0 0 32px;
  font-size: 1.1rem;
  color: var(--text-leise);
}

.start .log {
  margin-top: 20px;
}

/* ---------- Ansicht 2: Analyse ---------- */

.analyse-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.zelle-nummer {
  margin: 0;
  font-size: 1.05rem;
}

/* 10 Kästchen: erledigt / aktuell / noch offen */
.fortschritt {
  display: flex;
  gap: 5px;
}
.fortschritt span {
  width: 18px;
  height: 8px;
  border-radius: 2px;
  background: var(--rahmen);
}
.fortschritt span.fertig { background: var(--akzent); }
.fortschritt span.aktiv { background: var(--akzent-hell); box-shadow: 0 0 8px var(--akzent-hell); }

#analyse-log {
  min-height: 6em;           /* Platz für 4 Zeilen, damit nichts springt */
  margin-bottom: 14px;
}

/* Plots nebeneinander, Eingabe direkt unter der Himmelskarte (links).
   Auf schmalen Bildschirmen untereinander: Himmelskarte, Ausschnitt, Eingabe. */
.ausgabe {
  display: grid;
  grid-template-columns: 1fr 1fr;      /* Ausschnitt bekommt viel Platz zum Zählen */
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "moll    gnom"
    "eingabe gnom";
  gap: 16px;
  align-items: start;
}
.plot-moll { grid-area: moll; }
.plot-gnom { grid-area: gnom; }
.ausgabe .eingabe { grid-area: eingabe; }
.ausgabe.laedt .plot { opacity: 0.35; }

@media (max-width: 820px) {
  .ausgabe {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas: "moll" "gnom" "eingabe";
  }
}

.plot {
  margin: 0;
  min-width: 0;
}

.plot figcaption {
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-leise);
}
.out { color: var(--schluesselwort); }

/* Plots auf weißem Grund, wie die Ausgabe einer Notebook-Zelle */
.plot canvas {
  display: block;
  width: 100%;
  height: auto;
  background: white;
  border-radius: 6px;
  border: 1px solid var(--rahmen);
}
#mollview { aspect-ratio: 600 / 380; }
#gnomview { aspect-ratio: 1 / 1; max-width: 540px; }

/* ---------- Eingabe ---------- */

.eingabe {
  margin-top: 0;
  padding: 18px 20px;
  background: var(--hintergrund);
  border: 1px solid var(--rahmen);
  border-left: 3px solid var(--akzent);
  border-radius: 8px;
}

.eingabe-frage {
  display: block;
  margin-bottom: 12px;
  font-size: 1rem;
}
.eingabe-frage .kommentar {
  display: block;
  font-size: 13px;
}

.eingabe-zeile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.eingabe-zeile .code {
  font-size: 1.05rem;
}

#anzahl-eingabe,
.zahl-eingabe {
  width: 6.5em;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ok);
  background: var(--fenster);
  border: 1px solid var(--rahmen);
  border-radius: 6px;
  caret-color: var(--ok);
}
#anzahl-eingabe:focus,
.zahl-eingabe:focus {
  outline: none;
  border-color: var(--akzent-hell);
  box-shadow: 0 0 0 3px rgba(163, 113, 247, 0.25);
}
#anzahl-eingabe:disabled { opacity: 0.5; }

.hinweis {
  min-height: 1.4em;
  margin: 8px 0 0;
  font-size: 13px;
  color: #ffa657;
}

/* ---------- Ansicht 3: Rechnen (Zwischenseite) ---------- */

.ladebalken {
  width: min(480px, 100%);
  height: 8px;
  margin-top: 24px;
  background: var(--rahmen);
  border-radius: 4px;
  overflow: hidden;
}
.ladebalken span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--akzent-hell);
  box-shadow: 0 0 10px var(--akzent-hell);
}

/* ---------- Ansicht 4: Persönliches Ergebnis ---------- */

.ueberschrift {
  margin: 0 0 4px;
  font-size: 1.4rem;
}

.weiter-zeile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.admin-sprung {
  margin-top: 32px;
}


/* ---------- Ansicht 4: Admin ---------- */

.abschnitt {
  margin: 32px 0 10px;
  font-size: 1.05rem;
  font-weight: 600;
}

#admin-log {
  margin: 8px 0 16px;
}

/* Tabelle darf auf dem Handy seitlich scrollen, statt die Seite zu sprengen */
.tabelle-rahmen {
  overflow-x: auto;
}

.tabelle {
  border-collapse: collapse;
  font-size: 13px;
  white-space: pre;            /* Leerzeichen in den Zahlenreihen erhalten */
}
.tabelle th,
.tabelle td {
  padding: 6px 14px 6px 0;
  text-align: left;
  border-bottom: 1px solid var(--rahmen);
}
.tabelle th {
  color: var(--text-leise);
  font-weight: 400;
}

/* Code-Block für Export und Ausgabe */
.code-block {
  margin: 0;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--hintergrund);
  border: 1px solid var(--rahmen);
  border-radius: 8px;
  overflow-x: auto;
}

.gefahr-reihe {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px dashed var(--rahmen);
}

/* ---------- Ansicht 5: Ergebnis ---------- */

.plot-ergebnis {
  max-width: 760px;
  margin: 16px 0;
}
#ergebnis-plot,
#persoenlich-plot { aspect-ratio: 680 / 430; }

/* ---------- Ansicht 7: Computer-Ergebnis ---------- */

.beispiel-bild {
  display: block;
  width: 100%;
  height: auto;
  background: white;
  border: 1px solid var(--rahmen);
  border-radius: 6px;
}
.plot-ergebnis figcaption.kommentar {
  margin-top: 6px;
}

.ausgabe-text {
  max-width: 760px;
  white-space: pre-wrap;
}
