/* Werkzeug, kein Prospekt: dichte Zeilen, ruhige Flaechen, und genau eine
   Farbe, die zieht. Die Semantik der Voten (angenommen / verworfen) laeuft
   bewusst NEBEN dem Akzent, damit ein Urteil nicht wie ein Knopf aussieht. */

:root {
    color-scheme: light;

    --grund:    #f6f6f3;
    --flaeche:  #ffffff;
    --erhoben:  #eceae4;
    --linie:    #dddbd4;
    --linie-zart: #e9e7e1;
    --text:     #1a1c20;
    --leise:    #6b6f77;
    --sehr-leise: #9a9ea6;

    --akzent:      #8a6524;
    --akzent-hell: #f3ead6;

    --ja:        #2f6b4f;
    --ja-hell:   #e2efe7;
    --nein:      #9b3a34;
    --nein-hell: #f6e4e2;

    --radius: 6px;
    --schrift-ui: "IBM Plex Sans", ui-sans-serif, "Segoe UI", system-ui, sans-serif;
    --schrift-text: "Source Serif 4", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --grund:    #15171b;
        --flaeche:  #1c1f25;
        --erhoben:  #252931;
        --linie:    #2f343c;
        --linie-zart: #262a31;
        --text:     #e3e5e9;
        --leise:    #949aa4;
        --sehr-leise: #6b7078;

        --akzent:      #cda45c;
        --akzent-hell: #33291a;

        --ja:        #6fba93;
        --ja-hell:   #1c2b23;
        --nein:      #dd8d85;
        --nein-hell: #2e1f1e;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --grund:    #15171b;
    --flaeche:  #1c1f25;
    --erhoben:  #252931;
    --linie:    #2f343c;
    --linie-zart: #262a31;
    --text:     #e3e5e9;
    --leise:    #949aa4;
    --sehr-leise: #6b7078;

    --akzent:      #cda45c;
    --akzent-hell: #33291a;

    --ja:        #6fba93;
    --ja-hell:   #1c2b23;
    --nein:      #dd8d85;
    --nein-hell: #2e1f1e;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--grund);
    color: var(--text);
    font-family: var(--schrift-ui);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--akzent); }

/* ---- Info-Kasten: erklaerender Absatz hinter einem "i"-Knopf, auf allen
   Reitern gleich. <details>/<summary> statt eigenem JS - der Browser regelt
   Auf/Zu von selbst, und ein Screenreader kennt das Muster schon. */
.info-kasten { margin: 0 0 14px; }
.info-knopf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--linie);
    background: var(--erhoben);
    color: var(--leise);
    font: 600 12px/1 var(--schrift-ui);
    font-style: italic;
    cursor: pointer;
    user-select: none;
}
.info-knopf::-webkit-details-marker { display: none; }
.info-knopf::marker { content: ""; }
.info-knopf:hover { color: var(--akzent); border-color: var(--akzent); }
.info-kasten[open] > .info-knopf { color: var(--akzent); border-color: var(--akzent); }
.info-kasten > :not(summary) { margin-top: 8px; }

/* ---- Kopfleiste ---- */

.kopfleiste {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 0 22px;
    height: 52px;
    background: var(--flaeche);
    border-bottom: 1px solid var(--linie);
}

.marke {
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.marke span { color: var(--akzent); }

/* Die Menueleiste scrollt notfalls in sich, statt die ganze Seite breiter zu
   machen - mit vier Bereichen passte die Kopfleiste auf dem Handy nicht mehr
   und die Seite liess sich seitlich verschieben. */
.bereiche {
    display: flex;
    gap: 2px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.bereiche::-webkit-scrollbar { display: none; }

.bereiche a,
.bereiche span {
    display: block;
    flex: none;
    white-space: nowrap;
    padding: 5px 11px;
    border-radius: var(--radius);
    font-size: 13.5px;
    text-decoration: none;
    color: var(--leise);
}
.bereiche a:hover { background: var(--erhoben); color: var(--text); }
.bereiche .aktiv { background: var(--akzent-hell); color: var(--akzent); font-weight: 500; }

.alles-schalter {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--leise);
    cursor: pointer;
}
.alles-schalter input { accent-color: var(--akzent); width: 14px; height: 14px; }

/* ---- Set erstellen ---- */

.setbau {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 22px;
}
.setbau-leiste {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
}
.setbau-leiste[hidden] { display: none; }

.setbau-knopf {
    font: inherit;
    font-size: 13px;
    padding: 6px 12px;
    cursor: pointer;
    color: var(--akzent);
    background: var(--akzent-hell);
    border: 1px solid var(--akzent);
    border-radius: var(--radius);
}
.setbau-knopf:hover { filter: brightness(1.06); }

.setbau-leiste select {
    font: inherit;
    font-size: 13.5px;
    padding: 6px 9px;
    color: var(--text);
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
}

.setbau-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgb(0 0 0 / 45%);
}
.setbau-overlay[hidden] { display: none; }

.setbau-modal {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 22px 24px;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgb(0 0 0 / 22%);
}
.setbau-modal h3 {
    margin: 0 24px 10px 0;
    font-family: var(--schrift-text);
    font-size: 17px;
    font-weight: 600;
}
.setbau-modal input {
    font: inherit;
    font-size: 13.5px;
    width: 100%;
    padding: 7px 9px;
    margin-top: 10px;
    color: var(--text);
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
}
.setbau-modal-knoepfe {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}
.setbau-modal-knoepfe button {
    font: inherit;
    font-size: 13px;
    padding: 6px 13px;
    cursor: pointer;
    border-radius: var(--radius);
}
.knopf-abbrechen {
    color: var(--leise);
    background: var(--flaeche);
    border: 1px solid var(--linie);
}
.knopf-abbrechen:hover { color: var(--text); border-color: var(--sehr-leise); }
.knopf-start {
    color: var(--flaeche);
    background: var(--akzent);
    border: none;
}
.knopf-start:hover { filter: brightness(1.08); }
.knopf-start:disabled { opacity: 0.6; cursor: default; }

.setbau-schliessen {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 20px;
    line-height: 1;
    padding: 2px 6px;
    cursor: pointer;
    color: var(--sehr-leise);
    background: none;
    border: none;
}
.setbau-schliessen:hover { color: var(--text); }
.setbau-hinweis {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--leise);
}
.setbau-fehler {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--nein);
}

.setbau-status {
    position: relative;
    padding: 12px 38px 12px 14px;
    margin: 10px 0;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: 9px;
}
.setbau-statuskopf {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13.5px;
    color: var(--leise);
}
.setbau-statuskopf b { color: var(--akzent); }
.setbau-log-details { margin-top: 6px; }
.setbau-log-details summary {
    font-size: 12px;
    color: var(--sehr-leise);
    cursor: pointer;
    list-style: none;
}
.setbau-log-details summary::-webkit-details-marker { display: none; }
.setbau-log-details summary::before { content: "▸ "; }
.setbau-log-details[open] summary::before { content: "▾ "; }
.setbau-log-details summary:hover { color: var(--leise); }
.setbau-log {
    max-height: 260px;
    overflow-y: auto;
    margin: 8px 0 0;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    color: var(--text);
    background: var(--grund);
    border: 1px solid var(--linie-zart);
    border-radius: var(--radius);
}

.erweitert-knopf {
    font: inherit;
    font-size: 12.5px;
    padding: 6px 11px;
    cursor: pointer;
    color: var(--leise);
    background: transparent;
    border: 1px dashed var(--linie);
    border-radius: var(--radius);
}
.erweitert-knopf:hover { color: var(--text); border-color: var(--sehr-leise); }
.erweitert-knopf[aria-expanded="true"] { color: var(--akzent); border-color: var(--akzent); border-style: solid; }

.erweitert {
    margin-top: 4px;
    padding: 10px 12px 2px;
    border-top: 1px dashed var(--linie);
}
.erweitert[hidden] { display: none; }
.erweitert-hinweis {
    margin: 0 0 6px;
    font-size: 12px;
    color: var(--sehr-leise);
}

.cupbau-kategorien {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 4px 10px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}
.cupbau-kategorien li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 3px 8px;
    font-size: 12.5px;
    color: var(--sehr-leise);
    background: var(--grund);
    border: 1px solid var(--linie-zart);
    border-radius: var(--radius);
}
.cupbau-kategorien li[data-zustand="laeuft"] { color: var(--akzent); border-color: var(--akzent); }
.cupbau-kategorien li[data-zustand="fertig"] { color: var(--ja); }
.cupbau-kategorien li[data-zustand="fehler"] { color: var(--nein); border-color: var(--nein); }
.cupbau-kat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cupbau-kat-status { flex: none; font-variant-numeric: tabular-nums; }

/* Nur sichtbar, wenn ueberhaupt mehr als eine Kohorte im Blick ist (View
   "alle") - taucht eine Frage nicht als "aktuell" gefuehrt auf, markiert das
   auf einen Blick, aus welcher fruehen Generation sie stammt. Steht in der
   .fs-meta-Zeile der Karte (fragenschau.css), gemeinsam mit DQV-Fragen. */
.archiv-marke {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 1.5px 7px;
    border-radius: 99px;
    background: var(--erhoben);
    color: var(--sehr-leise);
    border: 1px solid var(--linie);
    white-space: nowrap;
}

/* ---- Voten (Annehmen/Verwerfen) - nur KI-Fragen, in die .fs-meta-Zeile der
   gemeinsamen Kartenoptik (fragenschau.css/.fs-karte) eingehaengt. */
.fs-karte[data-votum="hoch"]   { border-color: color-mix(in srgb, var(--ja) 45%, var(--linie)); }
.fs-karte[data-votum="runter"] { border-color: color-mix(in srgb, var(--nein) 40%, var(--linie)); opacity: 0.72; }
.fs-karte[data-votum="runter"]:hover { opacity: 1; }

.fs-voten { display: flex; gap: 4px; margin-left: auto; }
.fs-voten button {
    font: inherit;
    font-size: 12px;
    line-height: 1;
    padding: 4px 10px;
    cursor: pointer;
    color: var(--leise);
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
}
.fs-voten button:hover { color: var(--text); border-color: var(--sehr-leise); }
.fs-voten button:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }
.fs-karte[data-votum="hoch"]   .fs-voten .ja   { background: var(--ja);   border-color: var(--ja);   color: var(--flaeche); }
.fs-karte[data-votum="runter"] .fs-voten .nein { background: var(--nein); border-color: var(--nein); color: var(--flaeche); }

/* ---- Entstehungsgeschichte ---- */

.geschichte { border-top: 1px solid var(--linie-zart); }

.geschichte > summary {
    padding: 8px 18px;
    font-size: 12.5px;
    color: var(--leise);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.geschichte > summary::-webkit-details-marker { display: none; }
.geschichte > summary::before { content: "▸"; color: var(--sehr-leise); }
.geschichte[open] > summary::before { content: "▾"; }
.geschichte > summary:hover { color: var(--text); background: var(--erhoben); }

.geschichte-inhalt {
    padding: 4px 18px 18px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.block > h4 {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sehr-leise);
}

.werte {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 4px 20px;
}
.werte div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dotted var(--linie-zart); padding: 2px 0; }
.werte dt { color: var(--leise); }
.werte dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }

.anker {
    font-family: var(--schrift-text);
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--leise);
    border-left: 2px solid var(--linie);
    padding-left: 12px;
    margin: 0;
}

.versuch {
    border: 1px solid var(--linie-zart);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
}
.versuch-kopf {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
}
.versuch-nummer { font-weight: 600; color: var(--leise); }

.urteil {
    display: inline-block;
    padding: 1.5px 7px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 500;
}
.urteil.gut     { background: var(--ja-hell);   color: var(--ja); }
.urteil.schlecht { background: var(--nein-hell); color: var(--nein); }

.versuch .fragezeile { font-family: var(--schrift-text); font-size: 14.5px; margin: 0 0 8px; }
.versuch .fragezeile b { color: var(--akzent); font-weight: 600; }

/* Verworfene Startartikel: eigens eingerueckt und eingeklappt, damit der
   erfolgreiche Versuch beim Aufklappen der Geschichte weiter zuerst ins Auge
   faellt - "verworfen" heisst hier wirklich nachrangig, nicht gleichrangig. */
details.vorrunde {
    margin-bottom: 8px;
    padding-left: 10px;
    border-left: 2px solid var(--nein);
}
details.vorrunde > summary {
    cursor: pointer;
    list-style: none;
    font-size: 12.5px;
    color: var(--nein);
    padding: 2px 0;
}
details.vorrunde > summary::-webkit-details-marker { display: none; }
details.vorrunde > summary::before { content: "▸ "; color: var(--sehr-leise); }
details.vorrunde[open] > summary::before { content: "▾ "; }
details.vorrunde > summary b { color: var(--text); font-weight: 600; }
details.vorrunde .versuch { margin-top: 8px; }

.quoten { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.quote {
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    padding: 2px 7px;
    border-radius: var(--radius);
    background: var(--erhoben);
    color: var(--leise);
}
.quote.eigen { background: var(--akzent-hell); color: var(--akzent); font-weight: 600; }
.quote.rand { outline: 1px solid var(--nein); }

.begruendung {
    margin: 0 0 4px;
    color: var(--leise);
    line-height: 1.45;
}
.begruendung b { color: var(--text); font-weight: 500; }

@media (prefers-reduced-motion: no-preference) {
    .fs-karte { transition: opacity .15s, border-color .15s, box-shadow .15s; }
    .fs-voten button { transition: background .12s, color .12s, border-color .12s; }
}

@media (max-width: 720px) {
    /* Zwei Zeilen statt einer: oben das Menue, darunter die Zaehler. In einer
       Zeile quetschten die Zaehler das Menue auf einen einzigen Punkt
       zusammen, und die uebrigen Bereiche lagen unsichtbar im Scrollbereich -
       vom Handy aus kam man nicht mehr aus dem Fragenbestand heraus. Die
       Zaehler brechen von selbst um, sobald sie nicht mehr neben das Menue
       passen; der Speicherpunkt der Fragenschau passt und bleibt oben. */
    .kopfleiste {
        flex-wrap: wrap;
        height: auto;
        min-height: 52px;
        gap: 6px 10px;
        padding: 8px 12px;
    }
    .marke { display: none; }
}
