/* Morsecode -- Farben und Formensprache wie die uebrigen
   Jg6-Tools (vgl. evaBlackbox.css, zahlenraten.css). */

:root {
  --mc-primary: #4a6cf7;
  --mc-primary-dark: #3a5be0;
  --mc-ink: #2f3542;
  --mc-bg: #eef2f7;
  --mc-right: #2ecc71;
  --mc-wrong: #ff4a4a;
  --mc-gold: #ffd24a;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--mc-bg);
  color: #333;
}

.mc-screen {
  display: none;
  max-width: 820px;
  margin: 0 auto;
  padding: 30px 24px 60px 24px;
}

.mc-screen.mc-active { display: block; }

.mc-title {
  margin: 0 0 10px 0;
  font-size: 2rem;
  color: var(--mc-ink);
  text-align: center;
}

.mc-subtitle {
  margin: 0 auto 26px auto;
  max-width: 620px;
  text-align: center;
  line-height: 1.55;
  color: #555;
}

.mc-subtitle--klein {
  margin-top: 20px;
  font-size: 0.9rem;
}

/* ---------- Auswahl ---------- */

.mc-wahlgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.mc-wahlcard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 18px;
  background: var(--mc-ink);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mc-wahlcard:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.mc-wahlcard__icon { font-size: 2.2rem; line-height: 1; }

.mc-wahlcard__name {
  font-size: 1.15rem;
  font-weight: bold;
  color: var(--mc-gold);
}

.mc-wahlcard__text {
  font-size: 0.9rem;
  line-height: 1.45;
  color: #dfe4ec;
  text-align: center;
}

/* ---------- Karten und Felder ---------- */

.mc-card {
  margin: 0 auto 14px auto;
  max-width: 660px;
  padding: 18px 22px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.mc-card--mitte { text-align: center; }

.mc-card__title {
  margin: 0 0 10px 0;
  font-size: 1.05rem;
  color: var(--mc-ink);
}

.mc-card__hint {
  font-size: 0.82rem;
  font-weight: normal;
  color: #99a1b3;
}

.mc-feld {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #c7d0e0;
  border-radius: 8px;
  background: #fff;
  color: var(--mc-ink);
  font-family: Arial, sans-serif;
  font-size: 1.15rem;
  line-height: 1.5;
  resize: vertical;
}

.mc-feld:focus { outline: none; border-color: var(--mc-primary); }

.mc-feld--mono {
  font-family: "Courier New", monospace;
  letter-spacing: 0.08em;
}

.mc-pfeil {
  margin: 4px 0 10px 0;
  font-size: 1.6rem;
  color: var(--mc-primary);
  text-align: center;
}

/* ---------- Blinklampe ----------
   Bewusst gross und mittig: sie ist beim Abspielen das Gegenstueck
   zum Ton, damit auch ohne Lautsprecher etwas zu sehen ist. */

.mc-lampe {
  width: 100%;
  max-width: 660px;
  height: 54px;
  margin: 6px auto 14px auto;
  border-radius: 12px;
  background: #dfe4ec;
  border: 2px solid #c7d0e0;
  transition: background 0.05s linear;
}

.mc-lampe--an {
  background: var(--mc-gold);
  border-color: #e0b83a;
}

.mc-lampe--klein {
  max-width: 400px;
  height: 34px;
  margin: 4px auto 10px auto;
}

/* ---------- Knoepfe ---------- */

.mc-btn-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0 6px 0;
}

.mc-btn {
  padding: 12px 22px;
  border: none;
  border-radius: 8px;
  background: var(--mc-primary);
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.mc-btn:hover:enabled {
  background: var(--mc-primary-dark);
  transform: translateY(-2px);
}

.mc-btn:disabled { opacity: 0.45; cursor: default; }

.mc-btn--secondary { background: #99a1b3; }
.mc-btn--secondary:hover:enabled { background: #808a9e; }

/* ---------- Tempo ---------- */

.mc-tempo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 12px 0 6px 0;
  font-size: 0.95rem;
  color: #555;
}

.mc-tempo input { width: 190px; }

/* ---------- Hinweiszeile ---------- */

.mc-hinweis {
  min-height: 1.5em;
  margin-top: 8px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--mc-wrong);
}

/* ---------- Übung ---------- */

.mc-fortschritt {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  max-width: 660px;
  margin: 0 auto 12px auto;
  font-size: 0.95rem;
  color: #555;
}

.mc-punkte { font-weight: bold; color: var(--mc-ink); }

.mc-aufgabe {
  margin: 8px 0 20px 0;
  padding: 18px 10px;
  border-radius: 10px;
  background: var(--mc-ink);
  color: var(--mc-gold);
  font-family: "Courier New", monospace;
  font-size: 1.7rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  overflow-wrap: anywhere;
}

.mc-eingabezeile {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.mc-textfeld {
  width: 240px;
  height: 46px;
  padding: 0 12px;
  border: 2px solid #c7d0e0;
  border-radius: 8px;
  background: #fff;
  color: var(--mc-ink);
  font-size: 1.15rem;
  text-align: center;
  text-transform: uppercase;
}

.mc-textfeld:focus { outline: none; border-color: var(--mc-primary); }

.mc-feedback {
  min-height: 1.6em;
  margin-top: 14px;
  font-size: 1.05rem;
  font-weight: bold;
  line-height: 1.5;
}

.mc-feedback--right { color: #1f9d55; }
.mc-feedback--wrong { color: #d63a3a; }

.mc-feedback--ende {
  padding: 14px 18px;
  border-left: 5px solid var(--mc-gold);
  border-radius: 8px;
  background: #fff7dc;
  color: #5c4b12;
  font-weight: normal;
}

/* ---------- Tabelle ---------- */

.mc-hilfe {
  max-width: 660px;
  margin: 6px auto 10px auto;
  padding: 10px 16px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.mc-hilfe summary {
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--mc-primary);
}

.mc-tabelle {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.mc-zeichen {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

.mc-zeichen__buchstabe {
  font-size: 1.05rem;
  font-weight: bold;
  color: var(--mc-ink);
}

.mc-zeichen__code {
  font-family: "Courier New", monospace;
  font-size: 1.05rem;
  color: var(--mc-primary);
  letter-spacing: 0.06em;
}

/* Die beiden kuerzesten Zeichen sind hervorgehoben -- nicht nur
   farbig, sondern auch mit Rahmen, damit es ohne Farbwahrnehmung
   erkennbar bleibt. */
.mc-zeichen--kurz {
  border: 2px solid var(--mc-gold);
  background: #fff7dc;
}

/* ---------- Baumuebersicht ----------
   Zeigt die tatsaechliche Struktur des Morsealphabets: von der
   Wurzel aus links = Punkt, rechts = Strich. Je naeher am Stamm,
   desto kuerzer das Zeichen -- die Position ersetzt die frueher
   separat hervorgehobenen "kuerzesten Zeichen" (E, T stehen jetzt
   einfach ganz oben). Wird direkt aus dem MORSE-Objekt erzeugt,
   nicht von Hand gezeichnet -- bleibt so automatisch korrekt. */

.mc-baum {
  max-width: 720px;
  margin: 0 auto 10px auto;
  padding: 10px 6px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.mc-baum--klein { max-width: 520px; }

/* Baum + Legende nebeneinander (Uebersicht-Screen). */
.mc-baum-wrap {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.mc-baum-wrap .mc-baum {
  margin: 0;
  flex: 1;
  min-width: 280px;
}

.mc-baum-legende {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--mc-ink);
  flex-shrink: 0;
}

.mc-baum-legende__zeile {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.mc-baum-legende__swatch {
  width: 28px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.mc-baum-legende__swatch--punkt { background: var(--mc-primary); }
.mc-baum-legende__swatch--strich { background: var(--mc-gold); }

.mc-baum-svg { width: 100%; height: auto; display: block; }

.mc-baum-linie { stroke-width: 2; }
.mc-baum-linie--punkt { stroke: var(--mc-primary); }
.mc-baum-linie--strich { stroke: var(--mc-gold); }

.mc-baum-knoten {
  fill: #fff;
  stroke: var(--mc-ink);
  stroke-width: 1.5;
}

.mc-baum-wurzel { fill: var(--mc-ink); }

.mc-baum-label {
  font-family: Arial, sans-serif;
  font-size: 11px;
  font-weight: bold;
  fill: var(--mc-ink);
  text-anchor: middle;
}

/* ---------- Ergebnistabelle im Abschluss-Popup ----------
   Ergaenzt die geteilte PracticeGame-Erfolgskarte (siehe
   practiceGame.css) um eine Liste, welche Woerter richtig waren
   und was bei den falschen die Loesung gewesen waere. */

.mc-result-card--breit { max-width: 560px; }

.mc-ergebnis-liste {
  margin: 16px 0 0 0;
  max-height: 260px;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid #e4e9f0;
}

.mc-ergebnis-zeile {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 8px;
  padding: 7px 12px;
  font-size: 0.9rem;
  text-align: left;
  border-bottom: 1px solid #eef1f5;
}

.mc-ergebnis-zeile:last-child { border-bottom: none; }

.mc-ergebnis-zeile--kopf {
  font-weight: bold;
  color: #99a1b3;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f5f7fa;
}

.mc-ergebnis-code { font-family: "Courier New", monospace; color: var(--mc-primary); }
.mc-ergebnis-loesung--richtig { color: #1f9d55; font-weight: bold; }
.mc-ergebnis-loesung--falsch { color: #d63a3a; font-weight: bold; }

@media (prefers-reduced-motion: reduce) {
  .mc-wahlcard:hover, .mc-btn:hover:enabled { transform: none; }
  .mc-lampe { transition: none; }
}
