:root {
  --grund: #f6f6f7;
  --karte: #ffffff;
  --rand: #dcdce0;
  --text: #1c1c1f;
  --leise: #6a6a72;
  --akzent: #3d6b99;
  --dagegen: #b4574b;
  --dafuer: #4a7d5f;
  --ich: #b8761c;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grund: #17181a;
    --karte: #1f2023;
    --rand: #34353a;
    --text: #e8e8ea;
    --leise: #9a9aa2;
    --akzent: #7aa6d2;
    --dagegen: #cf7b70;
    --dafuer: #7fb193;
    --ich: #e0a34e;
  }
}

:root[data-theme="dark"] {
    --grund: #17181a;
    --karte: #1f2023;
    --rand: #34353a;
    --text: #e8e8ea;
    --leise: #9a9aa2;
    --akzent: #7aa6d2;
    --dagegen: #cf7b70;
    --dafuer: #7fb193;
    --ich: #e0a34e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--rand);
  background: var(--karte);
  position: sticky;
  top: 0;
  z-index: 5;
}

.marke { font-weight: 600; letter-spacing: 0.02em; }

nav { display: flex; gap: 0.4rem; }

.tab {
  border: 1px solid transparent;
  background: none;
  color: var(--leise);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
}
.tab:hover { color: var(--text); background: var(--grund); }
.tab.aktiv { color: var(--text); border-color: var(--rand); background: var(--grund); }

main { max-width: 780px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

.ansicht { display: none; }
.ansicht.aktiv { display: block; }

h1 { font-size: 1.5rem; margin: 0 0 0.5rem; font-weight: 600; }
h2 { font-size: 1rem; margin: 0 0 0.75rem; font-weight: 600; }
h2 small { font-weight: 400; color: var(--leise); }

.lead { color: var(--leise); margin: 0 0 1.75rem; }

form { display: flex; flex-direction: column; gap: 0.4rem; max-width: 380px; }
label { font-size: 0.9rem; color: var(--leise); }

input[type=text], input:not([type]) {
  font: inherit;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  background: var(--karte);
  color: var(--text);
}
input:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }

.hinweis { font-size: 0.85rem; color: var(--leise); margin: 0.1rem 0 0.9rem; }
.hinweis.fehler { color: var(--dagegen); }

button.gross {
  font: inherit;
  font-weight: 500;
  padding: 0.75rem 1.4rem;
  border: 1px solid var(--akzent);
  background: var(--akzent);
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  align-self: flex-start;
}
button.gross:hover { filter: brightness(1.08); }

button.flach {
  font: inherit;
  background: none;
  border: 1px solid var(--rand);
  color: var(--leise);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  cursor: pointer;
}
button.flach:hover:not(:disabled) { color: var(--text); }
button.flach:disabled { opacity: 0.4; cursor: default; }

/* Fragebogen */
.fortschritt { height: 4px; background: var(--rand); border-radius: 2px; overflow: hidden; }
.balken { height: 100%; width: 0; background: var(--akzent); transition: width 0.2s ease; }
.zaehler { font-size: 0.85rem; color: var(--leise); margin: 0.6rem 0 2rem; }

.these { min-height: 8.5rem; }
.thesetitel { font-size: 0.85rem; color: var(--leise); text-transform: uppercase; letter-spacing: 0.05em; }
.thesetext { font-size: 1.3rem; line-height: 1.4; margin: 0.5rem 0 0; }

.skala {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin: 2rem 0 1.5rem;
}

.stufe {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 0;
  padding: 0.5rem 0.2rem;
  cursor: pointer;
  font: inherit;
  color: var(--leise);
  border-radius: var(--radius);
}
.stufe:hover { background: var(--karte); }

.punktfeld {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.punkt {
  border: 2px solid currentColor;
  border-radius: 50%;
  background: var(--karte);
  transition: background 0.12s ease, transform 0.12s ease;
}
.stufe:hover .punkt { transform: scale(1.08); }
.stufe.gewaehlt .punkt { background: currentColor; }
.stufe.gewaehlt { color: var(--text); font-weight: 500; }

.stufe[data-wert="-2"], .stufe[data-wert="-1"] { color: var(--dagegen); }
.stufe[data-wert="1"],  .stufe[data-wert="2"]  { color: var(--dafuer); }

.stufentext { font-size: 0.78rem; text-align: center; line-height: 1.25; min-height: 2.5em; }

.steuerung { display: flex; align-items: center; justify-content: space-between; }
.tastenhilfe { font-size: 0.8rem; color: var(--leise); }

/* Ergebnisse */
.leiste {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--leise);
  margin-bottom: 1.25rem;
}
/* Der Farbschalter ist keine Navigation, also sieht er auch nicht so aus:
   abgesetzt hinter einem Trenner, rund statt eckig, mit Symbol statt Wort. */
.trenner {
  width: 1px;
  align-self: stretch;
  margin: 0.25rem 0.35rem;
  background: var(--rand);
}

.themaknopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--rand);
  border-radius: 50%;
  background: var(--grund);
  color: var(--leise);
  cursor: pointer;
}
.themaknopf:hover { color: var(--text); border-color: var(--akzent); }
.themaknopf:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.themaknopf svg { width: 18px; height: 18px; display: block; }

.schalter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--leise);
  margin-bottom: 1.25rem;
}
.schalter:hover { color: var(--text); }
.schalter input { accent-color: var(--akzent); }

.ichmarke {
  color: var(--ich);
  border: 1px solid var(--ich);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-weight: 500;
  white-space: nowrap;
}

/* Filter */
.filter { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }

.filter details {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
}
.filter summary {
  cursor: pointer;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  user-select: none;
}
.filter summary::marker { color: var(--leise); }
.anzahl { color: var(--leise); font-variant-numeric: tabular-nums; }

.wahlfeld { padding: 0 0.9rem 0.9rem; }

.schnell { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.6rem; flex-wrap: wrap; }
.schnell button {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--rand);
  border-radius: 999px;
  background: none;
  color: var(--leise);
  cursor: pointer;
}
.schnell button:hover { color: var(--text); }
.schnell input[type=search] {
  font: inherit;
  font-size: 0.82rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--rand);
  border-radius: 999px;
  background: var(--grund);
  color: var(--text);
  min-width: 10rem;
  flex: 1;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; max-height: 11rem; overflow-y: auto; }

.chip {
  font: inherit;
  font-size: 0.82rem;
  padding: 0.22rem 0.7rem;
  border: 1px solid var(--rand);
  border-radius: 999px;
  background: none;
  color: var(--leise);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.chip:hover { border-color: var(--akzent); }
.chip.an { background: var(--akzent); border-color: var(--akzent); color: #fff; }

/* Achsen */
.achsenwahl {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.achsenwahl .flach.aktiv {
  color: var(--text);
  border-color: var(--akzent);
  background: var(--karte);
}
.achsenwahl .flach:disabled { opacity: 0.35; }
.anteilhinweis { font-size: 0.85rem; color: var(--leise); margin-left: 0.3rem; }

.erklaerung { margin-bottom: 1.25rem; }
.erklaerung p {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  color: var(--leise);
  max-width: 60ch;
}
.erklaerung p:last-child { margin-bottom: 0; }

.ladung, .passzeile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46% 3.2rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.2rem 0;
}
.ladungname, .passname {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.passzeile .passname { color: var(--leise); }
.passzeile.teilnehmer .passname { color: var(--akzent); font-weight: 500; }

.bahn {
  position: relative;
  height: 14px;
  background: var(--grund);
  border-radius: 3px;
  overflow: hidden;
}
/* Mittellinie: von dort laufen die Balken nach links oder rechts. */
.ladungen .bahn::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--rand);
}
.balkenteil {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 2px;
}
.balkenteil.rechts { background: var(--akzent); }
.balkenteil.links { background: var(--dagegen); }
.balkenteil.voll { left: 0; background: var(--akzent); opacity: 0.75; }

.ladungwert {
  font-size: 0.8rem;
  color: var(--leise);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .ladung, .passzeile { grid-template-columns: minmax(0, 1fr) 34% 2.8rem; gap: 0.4rem; }
  .ladungname, .passname { font-size: 0.78rem; }
}

/* Parteien */
.these-karte {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}
.these-karte > summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  user-select: none;
}
.these-karte > summary::marker { color: var(--leise); }
.these-karte[open] > summary { border-bottom: 1px solid var(--rand); }
.these-name { font-weight: 500; }

.thesemarke {
  font-size: 0.72rem;
  color: var(--leise);
  border: 1px solid var(--rand);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  white-space: nowrap;
}

.streifen { display: inline-flex; gap: 2px; margin-left: auto; }
.kasten { width: 9px; height: 16px; border-radius: 2px; background: var(--leise); }
.kasten.dafuer { background: var(--dafuer); }
.kasten.dagegen { background: var(--dagegen); }
.kasten.neutral { background: var(--rand); }

.these-inhalt { padding: 0.9rem; }
.these-frage {
  margin: 0 0 1.1rem;
  font-size: 1.05rem;
  line-height: 1.45;
}

.gruppe { margin-bottom: 1.1rem; }
.gruppe:last-child { margin-bottom: 0; }
.gruppe h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.5rem;
}
.gruppe h3.dafuer { color: var(--dafuer); }
.gruppe h3.dagegen { color: var(--dagegen); }
.gruppe h3.neutral { color: var(--leise); }

.antwort {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--rand);
}
.parteiname { font-size: 0.85rem; font-weight: 500; }
.begruendung { margin: 0; font-size: 0.9rem; color: var(--leise); }
.begruendung.fehlt { font-style: italic; opacity: 0.7; }

@media (max-width: 560px) {
  .antwort { grid-template-columns: 1fr; gap: 0.15rem; }
  .streifen { margin-left: 0; }
}

.karte {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.plot { width: 100%; height: 300px; }
.plot.hoch { height: 480px; }

.leerhinweis {
  background: var(--karte);
  border: 1px dashed var(--rand);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: var(--leise);
  text-align: center;
}

footer {
  border-top: 1px solid var(--rand);
  padding: 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--leise);
}
footer a { color: inherit; }

@media (max-width: 560px) {
  .skala { gap: 0.2rem; }
  .stufentext { font-size: 0.68rem; }
  .thesetext { font-size: 1.1rem; }
}
