/* Testlabor — Graphit mit Rosé-Gold. Eine Akzentfarbe (Rosé) für Bedienung;
   Datenfarben getrennt und geprüft (validate_palette.js): Vorwoche Blau, Test Orange. */
:root {
  color-scheme: dark;
  --g0: #0A0B0D; --g1: #121418; --g2: #1B1E24; --g3: #262A31;
  --linie: #2A2E36;
  --text: #F2F0EC; --text-2: #BDB9B1; --text-3: #8F8C85;
  --akzent: #E9A68A; --akzent-2: #F3C3AE; --akzent-flaeche: rgba(233, 166, 138, .14);
  --akzent-glut: rgba(233, 166, 138, .35);
  --s-vw: #3987e5; --s-test: #d95926;
  --gut: #0ca30c; --gut-text: #5BD96E; --gut-flaeche: rgba(12, 163, 12, .16);
  --schlecht: #d03b3b; --schlecht-text: #FF8A80; --schlecht-flaeche: rgba(208, 59, 59, .17);
  --neutral-flaeche: rgba(189, 185, 177, .12);
  --raster: #252830;
  --radius: 18px;
  --schatten: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .25);
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --g0: #F6F4F1; --g1: #FFFFFF; --g2: #F0ECE7; --g3: #E3DED7;
    --linie: #E4DFD8;
    --text: #17181B; --text-2: #4B4A4F; --text-3: #6F6D69;
    --akzent: #A4573A; --akzent-2: #8A4429; --akzent-flaeche: rgba(164, 87, 58, .10);
    --akzent-glut: rgba(164, 87, 58, .22);
    --s-vw: #2a78d6; --s-test: #eb6834;
    --gut-text: #0A7A0A; --gut-flaeche: rgba(12, 163, 12, .11);
    --schlecht-text: #B42323; --schlecht-flaeche: rgba(208, 59, 59, .10);
    --neutral-flaeche: rgba(75, 74, 79, .08);
    --raster: #ECE8E2;
    --schatten: 0 1px 2px rgba(23, 24, 27, .05), 0 8px 24px rgba(23, 24, 27, .06);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--g0); }
body {
  margin: 0; min-height: 100vh; background: var(--g0); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--akzent); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.45rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1rem; font-weight: 620; }
h3 { font-size: .9rem; font-weight: 600; margin-top: 18px; }
p { margin: .35em 0; }
code { font-size: .86em; background: var(--g2); padding: 1px 5px; border-radius: 6px; }
.leise { color: var(--text-3); font-weight: 400; }
.klein { font-size: .84rem; }
.schlecht-text { color: var(--schlecht-text); }

/* Wortmarke */
.marke {
  font-family: ui-serif, "New York", Georgia, serif; font-style: italic; font-weight: 600;
  font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: .01em;
}
.marke span { color: var(--akzent); font-style: normal; }
.marke.gross { font-size: 2rem; margin: 6px 0 0; }

/* Kopf */
.kopf { max-width: 680px; margin: 0 auto; padding: 14px 16px 6px; }
.kopf-zeile { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.unterzeile { color: var(--text-2); font-size: .92rem; }
.fortschritt { margin-top: 12px; }
.balken-spur { height: 6px; border-radius: 99px; background: var(--g3); overflow: hidden; }
.balken-fuellung {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--akzent-2), var(--akzent));
  box-shadow: 0 0 12px var(--akzent-glut);
  animation: wachsen 1.1s cubic-bezier(.2, .8, .2, 1) both;
  transform-origin: left center;
}
.fortschritt .leise { font-size: .82rem; margin-top: 6px; }

/* Tabs */
.tabs {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; overflow-x: auto;
  max-width: 680px; margin: 8px auto 0; padding: 10px 16px;
  background: color-mix(in srgb, var(--g0) 82%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; padding: 8px 14px; border-radius: 99px; text-decoration: none; white-space: nowrap;
  color: var(--text-2); font-size: .9rem; font-weight: 560; background: var(--g1);
  border: 1px solid var(--linie);
}
.tabs a.aktiv { color: var(--g0); background: var(--akzent); border-color: var(--akzent); }
.zaehler {
  display: inline-block; min-width: 1.4em; padding: 0 6px; margin-left: 4px; border-radius: 99px;
  font-size: .75rem; background: var(--akzent-flaeche); color: var(--akzent); font-variant-numeric: tabular-nums;
}
.tabs a.aktiv .zaehler { background: rgba(0, 0, 0, .18); color: var(--g0); }

/* Inhalt */
.inhalt { max-width: 680px; margin: 0 auto; padding: 6px 16px 24px; display: grid; gap: 14px; }
.karte, .kachel, .urteil {
  background: var(--g1); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--schatten);
  animation: auftauchen .5s cubic-bezier(.2, .8, .2, 1) both;
}
.inhalt > :nth-child(2) { animation-delay: .04s; }
.inhalt > :nth-child(3) { animation-delay: .08s; }
.inhalt > :nth-child(4) { animation-delay: .12s; }
.karte h2, .kachel h2 { margin-bottom: 8px; }

.urteil { border-left: 4px solid var(--text-3); }
.urteil.gut { border-left-color: var(--gut); background: linear-gradient(90deg, var(--gut-flaeche), var(--g1) 70%); }
.urteil.schlecht { border-left-color: var(--schlecht); background: linear-gradient(90deg, var(--schlecht-flaeche), var(--g1) 70%); }
.urteil.neutral { border-left-color: var(--akzent); background: linear-gradient(90deg, var(--akzent-flaeche), var(--g1) 70%); }
.urteil-titel { font-size: 1.12rem; font-weight: 650; margin: 0 0 4px; }

.kacheln { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .kacheln { grid-template-columns: 1fr 1fr; } }
.kachel h2 { font-size: .92rem; }
.wert { font-size: 2.1rem; font-weight: 660; letter-spacing: -.02em; margin: 2px 0 2px; line-height: 1.1; }
.wert.mittel { font-size: 1.7rem; }
.vergleich { color: var(--text-2); font-size: .92rem; }
.vergleich strong { color: var(--text); font-weight: 620; }

/* Chips: Farbe nur zusammen mit Zeichen + Wort */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px;
  font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.chip.gut { background: var(--gut-flaeche); color: var(--gut-text); }
.chip.schlecht { background: var(--schlecht-flaeche); color: var(--schlecht-text); }
.chip.neutral { background: var(--neutral-flaeche); color: var(--text-2); }
.chip.neutral-stark { background: var(--akzent-flaeche); color: var(--akzent); }
.chip.leise { background: var(--neutral-flaeche); color: var(--text-3); font-weight: 500; }

.hinweis {
  margin: 0; padding: 10px 14px; border-radius: 14px; font-size: .9rem;
  background: var(--akzent-flaeche); color: var(--text);
}
.hinweis.schlecht { background: var(--schlecht-flaeche); }

.erklaerung p { font-size: .9rem; color: var(--text-2); }
.erklaerung strong { color: var(--text); }

/* Tabellen */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--text-3); font-weight: 560; font-size: .78rem; padding: 6px 4px; border-bottom: 1px solid var(--linie); }
td { padding: 7px 4px; border-bottom: 1px solid var(--linie); font-variant-numeric: tabular-nums; }
td + td, th + th { text-align: right; }
tr.unterzeile-zeile td { border-bottom: 1px solid var(--linie); padding-top: 0; text-align: left; }
tr:has(+ tr.unterzeile-zeile) td { border-bottom: 0; }
tr.im-test td { background: var(--akzent-flaeche); }
.vergleich-tabelle { margin-top: 8px; }
details.tabelle { margin-top: 8px; }
details.tabelle summary { cursor: pointer; color: var(--text-3); font-size: .84rem; padding: 4px 0; }
.definitionen dt { font-weight: 620; margin-top: 10px; }
.definitionen dd { margin: 2px 0 0; color: var(--text-2); font-size: .92rem; }
.punkte { padding-left: 18px; margin: 4px 0; color: var(--text-2); font-size: .92rem; }

/* Grafiken */
.grafik { width: 100%; height: auto; display: block; margin-top: 6px; overflow: visible; }
.grafik .raster { stroke: var(--raster); stroke-width: 1; }
.grafik .basis { stroke: var(--text-3); stroke-width: 1; opacity: .55; }
.grafik .achse { fill: var(--text-3); font-size: 9.5px; font-variant-numeric: tabular-nums; }
.grafik .achse.leer { opacity: .4; }
.grafik .achse.markiert { fill: var(--akzent); font-weight: 600; }
.grafik .endwert { fill: var(--text); font-size: 10.5px; font-weight: 650; }
.grafik .s-test { fill: var(--s-test); }
.grafik .s-vw { fill: var(--s-vw); }
.grafik .balken {
  transform-box: fill-box; transform-origin: center bottom; outline: none;
  animation: saeule .7s cubic-bezier(.2, .8, .2, 1) both;
}
.grafik .balken:hover, .grafik .balken:focus { filter: brightness(1.15); }
.grafik .linie { fill: none; stroke: var(--s-vw); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: zeichnen 1.4s cubic-bezier(.4, 0, .2, 1) .1s forwards; }
.grafik .punkt, .grafik .punkt-ende { stroke: var(--g1); stroke-width: 2; outline: none; }
.grafik .testzone { fill: var(--akzent); opacity: .07; }
.legende { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--text-2); margin-top: 4px; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.schluessel { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.schluessel.s-vw { background: var(--s-vw); }
.schluessel.s-test { background: var(--s-test); }

.tip {
  position: fixed; z-index: 20; pointer-events: none; max-width: 260px;
  padding: 7px 10px; border-radius: 10px; font-size: .8rem; line-height: 1.3;
  background: var(--text); color: var(--g0); box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}

/* Liste */
.liste { list-style: none; margin: 6px 0 0; padding: 0; }
.liste li + li { border-top: 1px solid var(--linie); }
.liste a {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 2px;
  color: var(--text); text-decoration: none;
}
.liste a:active { opacity: .7; }
.liste-titel { font-weight: 600; }
.liste-wert { font-variant-numeric: tabular-nums; font-weight: 600; }
.liste-unter { grid-column: 1 / -1; font-size: .84rem; }
.leer { color: var(--text-3); }

/* Knöpfe & Formulare */
.knopf {
  display: inline-block; padding: 11px 18px; border-radius: 14px; border: 1px solid var(--linie);
  background: var(--g2); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .12s ease;
}
.knopf:active { transform: scale(.97); }
.knopf.haupt { background: var(--akzent); color: #1A0F0A; border-color: var(--akzent); width: 100%; box-shadow: 0 6px 20px var(--akzent-glut); }
.knopf-text { background: none; border: 0; color: var(--text-3); font: inherit; font-size: .88rem; cursor: pointer; padding: 6px 0; }
.formular { display: grid; gap: 12px; margin-top: 18px; text-align: left; }
.formular label { display: grid; gap: 6px; font-size: .86rem; color: var(--text-2); }
.formular input {
  font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--linie); background: var(--g2); color: var(--text);
}
.formular input:focus { outline: 2px solid var(--akzent); outline-offset: 1px; }

/* Fuss */
.fuss {
  max-width: 680px; margin: 0 auto; padding: 4px 16px 40px; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between; gap: 10px;
}
.fuss p { font-size: .8rem; margin: 0; flex: 1 1 200px; }
.neu-pille {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 30; padding: 10px 18px; border-radius: 99px; border: 0; font: inherit; font-weight: 650; font-size: .9rem;
  background: var(--akzent); color: #1A0F0A; box-shadow: 0 10px 30px var(--akzent-glut); cursor: pointer;
  animation: auftauchen .4s cubic-bezier(.2, .8, .2, 1) both;
}
.neu-pille[hidden] { display: none; }

/* Eingang (Login / Einrichten) */
body.eingang {
  display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(120% 70% at 50% 0%, var(--akzent-flaeche), transparent 60%), var(--g0);
}
.eingang-karte {
  width: min(400px, 100%); text-align: center; padding: 28px 22px; border-radius: 24px;
  background: var(--g1); border: 1px solid var(--linie); box-shadow: var(--schatten);
}
.logo-kachel {
  width: 76px; height: 76px; margin: 0 auto; border-radius: 22px; display: grid; place-items: center;
  color: var(--akzent); background: var(--g2); border: 1px solid var(--linie);
  box-shadow: 0 0 30px var(--akzent-flaeche);
}
.logo-kachel svg { width: 44px; height: 44px; }
.kolben-umriss, .kolben-fluessig { stroke-dasharray: 1; stroke-dashoffset: 1; animation: zeichnen 1.6s cubic-bezier(.4, 0, .2, 1) .15s forwards; }
.kolben-fluessig { animation-delay: 1s; }

@keyframes zeichnen { to { stroke-dashoffset: 0; } }
@keyframes saeule { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes wachsen { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes auftauchen { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .grafik .linie, .kolben-umriss, .kolben-fluessig { stroke-dashoffset: 0; }
}

/* Vergleichslinie in Säulen-Grafiken + Legenden-Schlüssel dafür */
.grafik .referenz { stroke: var(--s-vw); stroke-width: 2; stroke-linecap: round; }
.grafik .referenz-text { fill: var(--text-2); font-size: 9.5px; font-weight: 600; paint-order: stroke; stroke: var(--g1); stroke-width: 3px; }
.schluessel-linie { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.schluessel-linie.s-vw { background: var(--s-vw); }

/* Testübersicht, Aktionen, Formular */
.status-zeile { margin: 0 0 6px; }
.aktionen { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.aktionen form { margin: 0; }
.klein-knopf { padding: 8px 14px; font-size: .88rem; border-radius: 12px; }
.haupt-klein { background: var(--akzent); color: #1A0F0A; border-color: var(--akzent); box-shadow: 0 6px 20px var(--akzent-glut); }
.test-karte { display: grid; gap: 4px; text-decoration: none; color: var(--text); border-left: 4px solid var(--linie); }
.test-karte.gut { border-left-color: var(--gut); }
.test-karte.schlecht { border-left-color: var(--schlecht); }
.test-karte.neutral { border-left-color: var(--akzent); }
.test-karte:active { transform: scale(.99); }
.test-kopf { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.test-urteil { font-weight: 600; }
.test-zahlen { font-size: .88rem; font-variant-numeric: tabular-nums; }
.leer-karte { text-align: center; display: grid; gap: 12px; justify-items: center; }
.test-formular { margin-top: 0; gap: 14px; }
.test-formular .karte { display: grid; gap: 10px; }
.test-formular textarea {
  font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 12px; resize: vertical;
  border: 1px solid var(--linie); background: var(--g2); color: var(--text);
}
.test-formular textarea:focus { outline: 2px solid var(--akzent); outline-offset: 1px; }
.wahl { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.wahl legend { font-size: .86rem; color: var(--text-2); margin-bottom: 4px; }
.wahl-zeile {
  display: flex !important; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px;
  border: 1px solid var(--linie); background: var(--g2); color: var(--text) !important; font-size: .95rem !important;
}
.wahl-zeile:has(input:checked) { border-color: var(--akzent); background: var(--akzent-flaeche); }
.wahl-zeile input { margin-top: 3px; accent-color: var(--akzent); width: 18px; height: 18px; flex: none; padding: 0; }
.zwei-spalten { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (max-width: 420px) { .zwei-spalten { grid-template-columns: 1fr; } }
.feld-fehler { color: var(--schlecht-text); font-size: .84rem; margin-top: -4px; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.test-formular:has(#art-aenderung:checked) .nur-zusatz { display: none; }
.gefahr { border-color: var(--schlecht-flaeche); display: grid; gap: 10px; }
.gefahr .knopf { color: var(--schlecht-text); }
