/*
 * Lernbereich.
 *
 * Farben und Rundungen stammen aus dem Fragentrainer der bestehenden
 * Plattform, damit sich das hier vertraut anfuehlt. Alles Markt-Eigene haengt
 * an den Variablen ganz oben: ein neuer Markt bekommt andere Werte, kein
 * eigenes Stylesheet. Deshalb steht hier auch kein einziger fester Farbwert
 * ausserhalb dieses Blocks.
 */
:root {
    --bg: linear-gradient(135deg, #f0f4ff 0%, #fef6f0 50%, #f0fdf4 100%);
    --bg-white: #ffffff;
    --bg-hover: #f0f2f5;
    --border: #e4e8ed;
    --border-light: #eef1f5;
    --text: #1a2332;
    --text-sec: #4a5568;
    --text-muted: #8494a7;
    --blue: #1c6ab7;
    --blue-light: #e8f1fa;
    --blue-hover: #155a9e;
    --green: #27ae60;
    --green-light: #eafaf1;
    --red: #e74c3c;
    --red-light: #fdf0ee;
    --yellow: #d4a017;
    --yellow-light: #fef9ec;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.03);
    --shadow-md: 0 4px 12px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
    --r: 14px;
    --rs: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg); background-attachment: fixed; color: var(--text);
    font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
}
a { color: var(--blue); }

.kopf {
    background: var(--bg-white); border-bottom: 1px solid var(--border);
    padding: 12px 16px; display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 20;
}
.kopf .marke { font-weight: 700; font-size: 15px; }
.kopf .rechts { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.kopf .zeit { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 13px; }

main { max-width: 760px; margin: 0 auto; padding: 18px 14px 60px; }

.karte {
    background: var(--bg-white); border: 1px solid var(--border-light);
    border-radius: var(--r); box-shadow: var(--shadow-sm);
    padding: 18px; margin-bottom: 14px;
}

/* Kacheln der Testteile */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.kachel {
    background: var(--bg-white); border: 1px solid var(--border-light);
    border-radius: var(--r); box-shadow: var(--shadow-sm);
    padding: 16px; cursor: pointer; transition: box-shadow .15s, transform .1s;
    text-align: left; font: inherit; color: inherit; width: 100%;
}
.kachel:hover:not(:disabled) { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kachel:disabled { opacity: .5; cursor: not-allowed; }
.kachel .titel { font-weight: 600; margin-bottom: 8px; }
.kachel .zahl { color: var(--text-muted); font-size: 13px; }
.balken { height: 6px; border-radius: 3px; background: var(--border-light); margin: 10px 0 6px; overflow: hidden; }
.balken > span { display: block; height: 100%; background: var(--blue); }

/* Frage */
.frage-kopf { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.chip {
    font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
    background: var(--bg-hover); color: var(--text-muted); border: 1px solid var(--border-light);
}
.stern {
    margin-left: auto; background: none; border: none; cursor: pointer;
    font-size: 19px; line-height: 1; color: var(--border); padding: 2px 4px;
}
.stern.an { color: var(--yellow); }

.q-body { font-size: 16px; line-height: 1.65; }
.q-body p { margin: 8px 0; }
.q-body .bl-formel { margin: 14px 0; text-align: center; overflow-x: auto; }
.q-body img, .opt img { max-width: 100%; height: auto; display: block; margin: 12px auto; }

.opts { margin-top: 16px; border: 1px solid var(--border-light); border-radius: 12px; background: var(--bg-white); padding: 0 14px; }
.opts.raster { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; border: none; }
.opt {
    display: flex; align-items: flex-start; gap: 12px; padding: 12px 0;
    cursor: pointer; border-top: 1px solid var(--border-light); transition: background .1s;
}
.opts.raster .opt {
    position: relative; flex-direction: column; align-items: center; border: 1px solid var(--border-light);
    border-radius: var(--rs); padding: 30px 10px 12px; gap: 4px;
}
.opt:first-child { border-top: none; }
.opts.raster .opt:first-child { border-top: 1px solid var(--border-light); }
.opt .kaestchen {
    flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border);
    margin-top: 1px; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; transition: all .15s;
    /* Der Buchstabe bleibt sichtbar, weil die Loesungswege auf ihn verweisen
       ("also Antwort D"). In der bestehenden Plattform ist er unsichtbar,
       dort nennen die Erklaerungen keine Buchstaben. */
    color: var(--text-muted);
}
.opts.raster .opt .kaestchen { position: absolute; top: 10px; left: 10px; margin-top: 0; }
.opt:hover .kaestchen { border-color: var(--blue); }
.opt.gewaehlt .kaestchen { background: var(--blue); border-color: var(--blue); color: #fff; }
.opt .inhalt { flex: 1; font-size: 15px; line-height: 1.5; }
.opt .inhalt p { margin: 0; }

/* Nach der Abgabe */
.opt.richtig { background: var(--green-light); border-radius: var(--rs); }
.opt.falsch { background: var(--red-light); border-radius: var(--rs); }
.opt.richtig .kaestchen { background: var(--green); border-color: var(--green); color: #fff; }
.opt.falsch .kaestchen { background: var(--red); border-color: var(--red); color: #fff; }
.opt .erklaerung { font-size: 13.5px; color: var(--text-sec); margin-top: 6px; }
.opt.erledigt { cursor: default; }

.knopf {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--blue); color: #fff; border: none; border-radius: var(--rs);
    padding: 12px 22px; font: inherit; font-weight: 600; cursor: pointer; transition: background .15s;
}
.knopf:hover:not(:disabled) { background: var(--blue-hover); }
.knopf:disabled { opacity: .45; cursor: not-allowed; }
.knopf.leise { background: transparent; color: var(--text-sec); border: 1px solid var(--border); }
.knopf.leise:hover { background: var(--bg-hover); }
.knopfzeile { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

.urteil { font-weight: 600; padding: 10px 14px; border-radius: var(--rs); margin-top: 14px; }
.urteil.ja { background: var(--green-light); color: var(--green); }
.urteil.nein { background: var(--red-light); color: var(--red); }

/* Lösungsweg */
.loesung { margin-top: 16px; }
.loesung > summary {
    cursor: pointer; font-weight: 600; padding: 10px 0; color: var(--blue); list-style: none;
}
.loesung > summary::-webkit-details-marker { display: none; }
.loesung > summary::before { content: "▸ "; }
.loesung[open] > summary::before { content: "▾ "; }
.schritt { border-left: 3px solid var(--border-light); padding: 2px 0 2px 14px; margin: 14px 0; }
.schritt h4 { margin: 0 0 4px; font-size: 14.5px; }
.tipp { background: var(--yellow-light); border-radius: var(--rs); padding: 10px 14px; margin-top: 12px; font-size: 14px; }

/* Farbhervorhebungen aus den Lösungswegen der Content-Maschine */
.fb.blau { color: var(--blue); } .fb.gruen { color: var(--green); }
.fb.rot { color: var(--red); } .fb.gelb { color: var(--yellow); }
.fb.violett { color: #7c3aed; } .fb.orange { color: #c1690a; } .fb.lila { color: #7c3aed; }

/* Daumen und Fehler melden */
.leiste { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-light); }
.leiste button {
    background: none; border: 1px solid var(--border); border-radius: 999px;
    padding: 5px 12px; cursor: pointer; font: inherit; font-size: 13px; color: var(--text-muted);
}
.leiste button:hover { background: var(--bg-hover); }
.leiste button.an { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.leiste .rechts { margin-left: auto; }

dialog {
    border: none; border-radius: var(--r); padding: 20px; max-width: 460px; width: 92%;
    box-shadow: var(--shadow-md); color: var(--text); font: inherit;
}
dialog::backdrop { background: rgba(15,23,42,.45); }
dialog textarea {
    width: 100%; min-height: 110px; border: 1px solid var(--border); border-radius: var(--rs);
    padding: 10px; font: inherit; resize: vertical;
}

.hinweis { color: var(--text-muted); font-size: 13.5px; }
.fehler { color: var(--red); font-size: 13.5px; margin-top: 6px; }

/* Anmeldung */
.schmal { max-width: 400px; margin: 40px auto; }
.feld { margin-bottom: 12px; }
.feld label { display: block; font-size: 13px; color: var(--text-sec); margin-bottom: 4px; }
.feld input {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: var(--rs); font: inherit; background: var(--bg-white);
}
.feld input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(28,106,183,.15); }
.reiter { display: flex; gap: 6px; margin-bottom: 16px; }
.reiter button {
    flex: 1; padding: 9px; border: 1px solid var(--border); background: var(--bg-white);
    border-radius: var(--rs); cursor: pointer; font: inherit;
}
.reiter button.an { background: var(--blue); color: #fff; border-color: var(--blue); }

@media (max-width: 560px) {
    main { padding: 12px 10px 50px; }
    .karte { padding: 14px; border-radius: var(--rs); }
    .q-body { font-size: 15.5px; }
    .opts.raster { grid-template-columns: 1fr 1fr; }
}
