/* Platzreife Theorietest
   Apple-Stil, mobile first: Systemschrift, gruppierte Listen auf grauem
   Grund, randlos. Grün ist die Aktionsfarbe, Kategorien haben eigene Farben
   (validiert für Farbsehschwäche), Richtig und Falsch immer mit Symbol. */

:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --elevated: #ffffff;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --hover: rgba(120, 120, 128, 0.07);
  --label: #1d1d1f;
  --label-2: #6e6e73;
  --label-3: #aeaeb2;
  --sep: rgba(60, 60, 67, 0.16);
  --bar: rgba(242, 242, 247, 0.82);
  --accent: #1e7d45;
  --accent-hover: #186a3a;
  --accent-text: #1a7340;
  --good: #0ca30c;
  --good-text: #006300;
  --bad: #d03b3b;
  --bad-text: #c42f2f;
  --muted: #8e8e93;
  --c-etikette: #2a78d6;
  --c-regeln: #eb6834;
  --c-allgemein: #1baf7a;
  --focus: #0071e3;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --side: max(1rem, env(safe-area-inset-left), env(safe-area-inset-right));
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --elevated: #2c2c2e;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.36);
    --hover: rgba(118, 118, 128, 0.14);
    --label: #f5f5f7;
    --label-2: #98989d;
    --label-3: #636366;
    --sep: rgba(84, 84, 88, 0.55);
    --bar: rgba(0, 0, 0, 0.72);
    --accent: #23874c;
    --accent-hover: #2a9656;
    --accent-text: #30d158;
    --good: #0ca30c;
    --good-text: #30d158;
    --bad: #d03b3b;
    --bad-text: #ff6961;
    --muted: #636366;
    --c-etikette: #3987e5;
    --c-regeln: #d95926;
    --c-allgemein: #199e70;
    --focus: #0a84ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  scroll-padding-top: 4.5rem;
  scroll-padding-bottom: 6rem;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button, .answer, .row, .dot, summary, .segmented label {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.large-title:focus, .q-text:focus { outline: none; }

.noscript { max-width: 30rem; margin: 3rem auto; padding: 0 1rem; }

.wrap {
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding-left: var(--side);
  padding-right: var(--side);
}

/* ------------------------------------------------------------------ Icons */

.ico {
  width: 1.25em; height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.badge {
  display: inline-grid; place-items: center;
  width: 1.5rem; height: 1.5rem;
  flex: none;
  color: #fff;
  border-radius: 999px;
}
.badge .ico { width: 0.95rem; height: 0.95rem; stroke-width: 2.8; }
.badge--good { background: var(--good); }
.badge--bad { background: var(--bad); }
.badge--muted { background: var(--muted); }
.badge--accent { background: var(--accent); }
.badge--xl { width: 4.5rem; height: 4.5rem; }
.badge--xl .ico { width: 2.3rem; height: 2.3rem; stroke-width: 2.2; }

.tile {
  display: inline-grid; place-items: center;
  width: 1.875rem; height: 1.875rem;
  flex: none;
  color: #fff;
  border-radius: 0.5rem;
}
.tile .ico { width: 1.15rem; height: 1.15rem; stroke-width: 2.1; }
.tile--alle { background: var(--accent); }
.tile--etikette { background: var(--c-etikette); }
.tile--regeln { background: var(--c-regeln); }
.tile--allgemein { background: var(--c-allgemein); }
.tile--sm { width: 1.375rem; height: 1.375rem; border-radius: 0.375rem; }
.tile--sm .ico { width: 0.85rem; height: 0.85rem; stroke-width: 2.4; }

/* ---------------------------------------------------------------- Buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3.125rem;
  padding: 0 1.4rem;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn .ico { width: 1.1rem; height: 1.1rem; }
.btn--primary { color: #fff; background: var(--accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary { color: var(--accent-text); background: var(--fill); }
.btn--secondary:hover { background: var(--fill-strong); }
.btn--plain { color: var(--accent-text); background: transparent; }
.btn--plain:hover { background: var(--hover); }
.btn--block { width: 100%; }
.btn--small { min-height: 2.5rem; padding: 0 1.1rem; font-size: 0.9375rem; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.btn--primary:disabled:hover { background: var(--accent); }

.iconbtn {
  display: inline-grid; place-items: center;
  width: 2.75rem; height: 2.75rem;
  padding: 0;
  color: var(--label);
  background: var(--fill);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.iconbtn:hover { background: var(--fill-strong); }
.iconbtn .ico { width: 1.2rem; height: 1.2rem; stroke-width: 2.2; }
.iconbtn:disabled { opacity: 0.35; cursor: not-allowed; }
.iconbtn:disabled:hover { background: var(--fill); }
/* Runde Buttons in der unteren Leiste, so hoch wie der Hauptbutton */
.iconbtn--bar { width: 3.125rem; height: 3.125rem; flex: none; }
.iconbtn--bar .ico { width: 1.3rem; height: 1.3rem; }

/* ------------------------------------------------------- Bausteine, Text */

.large-title {
  font-size: 2.125rem;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
}
.section-title {
  margin: 2.25rem 0 0.25rem;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.section-sub { margin-bottom: 0.85rem; font-size: 0.9375rem; color: var(--label-2); }
.footnote { font-size: 0.8125rem; line-height: 1.45; color: var(--label-2); }
.mini { font-size: 0.8125rem; color: var(--label-2); margin-bottom: 0.5rem; }

.card {
  padding: 1.25rem;
  background: var(--surface);
  border-radius: 1.25rem;
}
.card + .card { margin-top: 1rem; }
.card-title { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.card-title--sm { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; }
.card-sub { margin-top: 0.25rem; font-size: 0.9375rem; color: var(--label-2); }

/* Gruppierte Liste wie in den iOS-Einstellungen */
.group { background: var(--surface); border-radius: 1rem; overflow: hidden; }
.group > li { position: relative; }
.group > li + li::before {
  content: "";
  position: absolute; top: 0; right: 0; left: 3.7rem;
  border-top: 1px solid var(--sep);
  z-index: 1;
}
@media (min-resolution: 2dppx) {
  .group > li + li::before { border-top-width: 0.5px; }
}

.row {
  display: flex; align-items: center; gap: 0.85rem;
  width: 100%;
  min-height: 3.75rem;
  padding: 0.7rem 1rem;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.row:hover { background: var(--hover); }
.row:active { background: var(--fill); }
.row-text { flex: 1; min-width: 0; display: grid; }
.row-title { font-weight: 400; }
.row-sub { font-size: 0.8125rem; color: var(--label-2); }
.row-value { color: var(--label-2); font-variant-numeric: tabular-nums; }
.chev { width: 0.95rem; height: 0.95rem; color: var(--label-3); stroke-width: 2.6; }

/* ------------------------------------------------------------- Startseite */

/* Startseite und Ergebnis: Inhalt oben, feste Aktionsleiste unten */
.view-home, .view-result { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.home, .result { flex: 1; padding-bottom: 2rem; }

.home-head {
  display: flex; align-items: center; gap: 0.85rem;
  padding: calc(env(safe-area-inset-top) + 1.25rem) 0 1.25rem;
}
.app-icon {
  width: 3.25rem; height: 3.25rem;
  flex: none;
  border-radius: 22.5%;
  box-shadow: 0 0.2rem 0.7rem rgba(20, 102, 58, 0.25);
}
.subtitle { margin-top: 0.1rem; font-size: 0.9375rem; color: var(--label-2); }

/* Kompakte Titelleiste beim Scrollen */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  padding-top: env(safe-area-inset-top);
  opacity: 0;
  visibility: hidden;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--sep);
  transition: opacity 0.2s, visibility 0.2s;
}
@media (min-resolution: 2dppx) { .navbar { border-bottom-width: 0.5px; } }
.navbar.is-shown { opacity: 1; visibility: visible; }
.navbar-row { display: grid; place-items: center; height: 2.75rem; }
.navbar-title { font-size: 1.0625rem; font-weight: 600; }

.facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem;
  margin: 1.1rem 0 1.25rem;
}
.fact {
  display: grid; gap: 0.3rem; align-content: start;
  padding: 0.8rem 0.75rem;
  background: var(--surface-2);
  border-radius: 0.875rem;
}
.fact .ico { width: 1.25rem; height: 1.25rem; color: var(--accent-text); }
.fact-value { font-size: 1.5rem; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.fact-label { font-size: 0.75rem; line-height: 1.25; color: var(--label-2); }

/* Aufteilung: schmaler Balken in Abschnitten, Legende darunter */
.composition { margin-bottom: 1.4rem; }
.composition:last-child { margin-bottom: 0; }
.seg-bar { display: flex; gap: 2px; height: 8px; }
.seg { flex: var(--n) 1 0; min-width: 4px; }
.seg:first-child { border-radius: 4px 0 0 4px; }
.seg:last-child { border-radius: 0 4px 4px 0; }
.seg:only-child { border-radius: 4px; }
.seg--etikette, .swatch--etikette { background: var(--c-etikette); }
.seg--regeln, .swatch--regeln { background: var(--c-regeln); }
.seg--allgemein, .swatch--allgemein { background: var(--c-allgemein); }
.seg-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; margin-top: 0.6rem; font-size: 0.8125rem; color: var(--label-2); }
.seg-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.seg-n { color: var(--label); font-weight: 600; font-variant-numeric: tabular-nums; }
.swatch { width: 0.625rem; height: 0.625rem; border-radius: 999px; }

.last-head { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1rem; }
.last-head .badge { margin-top: 0.1rem; }
.last .footnote { margin-top: 0.75rem; }

/* Installieren: Listenzeile auf der Startseite, Anleitung im Blatt */
.install { margin-top: 1.5rem; }
.row-icon { width: 1.875rem; height: 1.875rem; flex: none; border-radius: 22.5%; }
.chev--action { width: 1.2rem; height: 1.2rem; color: var(--accent-text); stroke-width: 2.2; }

.install-steps { display: grid; gap: 0.9rem; margin: 1.4rem 0 1.1rem; }
.install-steps li { display: flex; align-items: center; gap: 0.75rem; line-height: 1.35; }
.step-num {
  display: inline-grid; place-items: center;
  width: 1.5rem; height: 1.5rem;
  flex: none;
  font-size: 0.8125rem; font-weight: 700;
  color: var(--surface);
  background: var(--label);
  border-radius: 999px;
}
.step-ico {
  display: inline-grid; place-items: center;
  width: 2.5rem; height: 2.5rem;
  flex: none;
  color: var(--focus);
  background: var(--surface-2);
  border-radius: 0.65rem;
}
.step-ico .ico { width: 1.35rem; height: 1.35rem; }
.install-note { margin-bottom: 1.25rem; }

.footnote--page { margin-top: 2rem; padding: 0 0.25rem; }

/* ------------------------------------------------------------------- Meter */

.meter-track {
  position: relative;
  height: 10px;
  background: var(--track);
  border-radius: 999px;
}
.meter-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: calc(var(--v) * 100%);
  background: var(--tone);
  border-radius: 999px;
  animation: grow 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s both;
}
.meter-tick {
  position: absolute; top: -4px; bottom: -4px;
  left: calc(var(--p) * 100%);
  width: 2px; margin-left: -1px;
  background: var(--label);
  border-radius: 1px;
}
.meter-scale { position: relative; height: 1.1rem; margin-top: 0.4rem; font-size: 0.75rem; color: var(--label-2); }
.meter-pass { position: absolute; left: calc(var(--p) * 100%); transform: translateX(-50%); white-space: nowrap; }
.meter--good { --tone: var(--good); --track: color-mix(in srgb, var(--good) 16%, transparent); }
.meter--bad { --tone: var(--bad); --track: color-mix(in srgb, var(--bad) 15%, transparent); }
.meter--accent { --tone: var(--accent); --track: color-mix(in srgb, var(--accent) 15%, transparent); }

@keyframes grow { from { width: 0; } }

/* ------------------------------------------------------------------- Quiz */

.view-quiz { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
.topbar-row {
  display: grid; grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem; gap: 0.5rem; align-items: center;
  padding-top: 0.5rem; padding-bottom: 0.5rem;
}
.topbar-title { display: grid; text-align: center; line-height: 1.25; }
.topbar-title strong { font-size: 1.0625rem; font-weight: 600; }
.topbar-sub { font-size: 0.8125rem; color: var(--label-2); font-variant-numeric: tabular-nums; }
.topbar-sub.is-low { color: var(--bad-text); font-weight: 600; }

.progress { height: 4px; margin-bottom: 0.6rem; background: var(--fill); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.3s ease; }

.quiz-body { flex: 1; padding-top: 1.1rem; padding-bottom: 1.5rem; }

.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin-bottom: 0.9rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.25rem 0.7rem 0.25rem 0.3rem;
  font-size: 0.8125rem; font-weight: 600;
  background: var(--surface);
  border-radius: 999px;
}
.level { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8125rem; color: var(--label-2); }
.level-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 0.8rem; }
.level-bars i { width: 3px; background: var(--fill-strong); border-radius: 1px; }
.level-bars i:nth-child(1) { height: 40%; }
.level-bars i:nth-child(2) { height: 70%; }
.level-bars i:nth-child(3) { height: 100%; }
.level[data-level="1"] i:nth-child(-n+1),
.level[data-level="2"] i:nth-child(-n+2),
.level[data-level="3"] i { background: var(--label-2); }

.q-text {
  margin-bottom: 1.25rem;
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.02em;
  text-wrap: pretty;
}

.answers { display: grid; gap: 0.625rem; }
.answer {
  position: relative;
  display: flex; align-items: center; gap: 0.85rem;
  min-height: 3.5rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border-radius: 1rem;
  box-shadow: inset 0 0 0 2px transparent;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.answer input { position: absolute; opacity: 0; pointer-events: none; }
.answer-key {
  display: grid; place-items: center;
  width: 2rem; height: 2rem;
  flex: none;
  font-size: 0.9375rem; font-weight: 600;
  background: var(--fill);
  border-radius: 999px;
  transition: background-color 0.15s, color 0.15s;
}
.answer-text { flex: 1; min-width: 0; line-height: 1.38; }
.answer-note { display: block; margin-top: 0.15rem; font-size: 0.8125rem; font-weight: 600; color: var(--label-2); }
.answers:not(.is-revealed) .answer:hover { background: color-mix(in srgb, var(--surface) 92%, var(--label)); }
.answer:has(input:checked) { box-shadow: inset 0 0 0 2px var(--label); }
.answer:has(input:checked) .answer-key { color: var(--surface); background: var(--label); }
.answer:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

.answers.is-revealed .answer { cursor: default; box-shadow: inset 0 0 0 2px transparent; }
.answers.is-revealed .answer:not(.is-right):not(.is-wrong) { opacity: 0.6; }
.answers.is-revealed .answer.is-right { box-shadow: inset 0 0 0 2px var(--good); }
.answers.is-revealed .answer.is-right .answer-key { color: #fff; background: var(--good); }
.answers.is-revealed .answer.is-right .answer-note { color: var(--good-text); }
.answers.is-revealed .answer.is-wrong { box-shadow: inset 0 0 0 2px var(--bad); }
.answers.is-revealed .answer.is-wrong .answer-key { color: #fff; background: var(--bad); }
.answers.is-revealed .answer.is-wrong .answer-note { color: var(--bad-text); }

/* Lösung in der unteren Leiste (Daumenzone), getönt nach Ergebnis */
.bottombar--feedback {
  padding-top: 1rem;
  border-top: 0;
  box-shadow: 0 -0.5rem 1.5rem rgba(0, 0, 0, 0.08);
  animation: rise 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.bottombar--feedback.is-right { background: color-mix(in srgb, var(--good) 10%, var(--surface)); }
.bottombar--feedback.is-wrong { background: color-mix(in srgb, var(--bad) 9%, var(--surface)); }
.feedback {
  max-height: 46dvh;
  margin-bottom: 0.9rem;
  overflow-y: auto;
  font-size: 0.9375rem;
  line-height: 1.42;
}
.feedback-head { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.4rem; }
.feedback-head h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.feedback.is-right .feedback-head h2 { color: var(--good-text); }
.feedback.is-wrong .feedback-head h2 { color: var(--bad-text); }
.feedback-solution { margin-bottom: 0.35rem; font-weight: 600; }
.feedback .rule { margin-top: 0.6rem; background: color-mix(in srgb, var(--label) 7%, transparent); }
.rule {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin-top: 0.8rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.8125rem; color: var(--label-2);
  background: var(--fill);
  border-radius: 999px;
}
.rule .ico { width: 0.95rem; height: 0.95rem; }

@keyframes rise { from { opacity: 0.4; transform: translateY(1.5rem); } }

.keys-hint, .swipe-hint { display: none; margin-top: 1rem; font-size: 0.8125rem; color: var(--label-2); }
@media (hover: hover) and (pointer: fine) { .keys-hint { display: block; } }
@media (hover: none) and (pointer: coarse) { .swipe-hint { display: block; text-align: center; } }

/* Fragewechsel: Inhalt kommt aus der Richtung, in die geblättert wurde */
.enter-next { animation: enter-next 0.24s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.enter-prev { animation: enter-prev 0.24s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes enter-next { from { opacity: 0; transform: translateX(2rem); } }
@keyframes enter-prev { from { opacity: 0; transform: translateX(-2rem); } }

.bottombar {
  position: sticky; bottom: 0; z-index: 20;
  padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom));
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--sep);
}
@media (min-resolution: 2dppx) { .bottombar { border-top-width: 0.5px; } }
.bottombar-row { display: flex; gap: 0.75rem; }
.bottombar-row .btn--primary { flex: 1; }

/* --------------------------------------------------------------- Ergebnis */

.result-hero {
  display: grid; justify-items: center;
  padding: calc(env(safe-area-inset-top) + 2.5rem) 0 1.75rem;
  text-align: center;
}
.result-hero .badge--xl { margin-bottom: 1rem; animation: pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
.hero { display: flex; align-items: baseline; gap: 0.5rem; margin: 0.6rem 0 1.1rem; }
.hero-num { font-size: 3.75rem; font-weight: 700; line-height: 1; letter-spacing: -0.04em; }
.hero-of { font-size: 1.0625rem; color: var(--label-2); }
.result-hero .meter { width: 100%; max-width: 22rem; }
.result-lead { margin-top: 0.9rem; max-width: 30ch; color: var(--label-2); }

@keyframes pop { from { opacity: 0; transform: scale(0.6); } }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.625rem; }
.kpi { display: grid; gap: 0.3rem; padding: 0.85rem 1rem; background: var(--surface); border-radius: 1rem; }
.kpi-label { display: flex; align-items: center; gap: 0.45rem; font-size: 0.8125rem; color: var(--label-2); }
.kpi-label .badge { width: 1.25rem; height: 1.25rem; }
.kpi-label .badge .ico { width: 0.8rem; height: 0.8rem; }
.kpi-ico { width: 1.25rem; height: 1.25rem; color: var(--label-2); }
.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.03em; }

/* Kategorien: Name, Wert und Balken je Zeile */
.catrow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "tile name value" "tile bar bar";
  gap: 0.45rem 0.85rem; align-items: center;
  padding: 0.85rem 1rem;
}
.catrow .tile { grid-area: tile; align-self: center; }
.cat-name { grid-area: name; }
.cat-value { grid-area: value; font-size: 0.9375rem; color: var(--label-2); font-variant-numeric: tabular-nums; }
.cat-bar { grid-area: bar; position: relative; height: 6px; background: color-mix(in srgb, var(--c) 18%, transparent); border-radius: 999px; }
.cat-bar > span {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: calc(var(--v) * 100%);
  background: var(--c);
  border-radius: 999px;
  animation: grow 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.25s both;
}
.cat-bar--etikette { --c: var(--c-etikette); }
.cat-bar--regeln { --c: var(--c-regeln); }
.cat-bar--allgemein { --c: var(--c-allgemein); }

.result-actions { display: grid; gap: 0.6rem; margin-top: 1.75rem; }

.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  margin-bottom: 0.85rem; padding: 2px;
  background: var(--fill);
  border-radius: 0.6rem;
}
.segmented label {
  position: relative;
  padding: 0.45rem 0.5rem;
  font-size: 0.8125rem; font-weight: 600; text-align: center;
  border-radius: 0.5rem;
  cursor: pointer;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--elevated); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
.segmented label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }

.review > li + li::before { left: 3.4rem; }
.review.only-wrong .rv.is-correct { display: none; }
.rv summary {
  display: flex; align-items: flex-start; gap: 0.8rem;
  padding: 0.85rem 1rem;
  list-style: none;
  cursor: pointer;
}
.rv summary::-webkit-details-marker { display: none; }
.rv summary:hover { background: var(--hover); }
.rv summary .badge { margin-top: 0.1rem; }
.rv summary .chev { margin-top: 0.25rem; transition: transform 0.2s; }
.rv details[open] summary .chev { transform: rotate(90deg); }
.rv-q { flex: 1; min-width: 0; display: grid; gap: 0.1rem; }
.rv-meta { font-size: 0.75rem; color: var(--label-2); }
.rv-text { line-height: 1.35; }
.rv-body { padding: 0 1rem 1.1rem 3.3rem; }
.rv-open { margin-bottom: 0.4rem; font-weight: 600; color: var(--label-2); }
.rv-opts { display: grid; gap: 0.4rem; margin-bottom: 0.8rem; }
.rv-opt { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.9375rem; line-height: 1.35; color: var(--label-2); }
.rv-opt .badge { width: 1.25rem; height: 1.25rem; margin-top: 0.05rem; }
.rv-opt .badge .ico { width: 0.75rem; height: 0.75rem; }
.rv-opt.is-right, .rv-opt.is-wrong { color: var(--label); }
.rv-key {
  display: inline-grid; place-items: center;
  width: 1.25rem; height: 1.25rem;
  flex: none;
  font-size: 0.6875rem; font-weight: 700;
  background: var(--fill);
  border-radius: 999px;
}
.rv-note { display: block; font-size: 0.75rem; font-weight: 600; color: var(--label-2); }
.rv-opt.is-right .rv-note { color: var(--good-text); }
.rv-opt.is-wrong .rv-note { color: var(--bad-text); }
.rv-expl { font-size: 0.9375rem; }

/* ---------------------------------------------------------------- Dialoge */

dialog { padding: 0; color: var(--label); border: 0; }
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }

.sheet {
  width: 100%; max-width: 42rem;
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 0.5rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  overflow: auto;
  background: var(--surface);
  border-radius: 1.25rem 1.25rem 0 0;
}
.sheet[open] { animation: sheet-up 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet[open]::backdrop { animation: fade 0.3s ease-out; }
.sheet-grabber { width: 2.25rem; height: 5px; margin: 0 auto 0.75rem; background: var(--fill-strong); border-radius: 3px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.sheet-head h2 { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; }
.sheet-sub { font-size: 0.9375rem; color: var(--label-2); }

.dots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.65rem; margin: 1.25rem 0 1rem; }
.dot {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  font-size: 0.9375rem; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--label);
  background: var(--fill);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.dot.is-answered { color: var(--surface); background: var(--label); }
.dot.is-right { color: #fff; background: var(--good); }
.dot.is-wrong { color: #fff; background: var(--bad); }
.dot.is-current { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.dot-mark {
  position: absolute; top: -3px; right: -3px;
  display: grid; place-items: center;
  width: 1.05rem; height: 1.05rem;
  background: var(--surface);
  border-radius: 999px;
}
.dot-mark .ico { width: 0.7rem; height: 0.7rem; stroke-width: 3.2; }
.dot.is-right .dot-mark { color: var(--good); }
.dot.is-wrong .dot-mark { color: var(--bad); }

.dot-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; margin-bottom: 1.25rem; font-size: 0.8125rem; color: var(--label-2); }
.dot-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.dot-key { display: inline-grid; place-items: center; width: 0.95rem; height: 0.95rem; border-radius: 999px; color: #fff; }
.dot-key .ico { width: 0.6rem; height: 0.6rem; stroke-width: 3.4; }
.dot-key.is-answered { background: var(--label); }
.dot-key.is-empty { background: var(--fill-strong); }
.dot-key.is-right { background: var(--good); }
.dot-key.is-wrong { background: var(--bad); }

.alert {
  width: min(17.5rem, calc(100% - 3rem));
  margin: auto;
  overflow: hidden;
  text-align: center;
  background: var(--elevated);
  border-radius: 1rem;
}
.alert[open] { animation: pop 0.2s ease-out; }
.alert-body { padding: 1.25rem 1rem 1rem; }
.alert-body h2 { font-size: 1.0625rem; font-weight: 600; }
.alert-body p { margin-top: 0.3rem; font-size: 0.8125rem; line-height: 1.4; color: var(--label); }
.alert-actions { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--sep); }
.alert-btn {
  min-height: 2.9rem;
  padding: 0.5rem;
  font-size: 1.0625rem;
  color: var(--accent-text);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.alert-btn + .alert-btn { border-left: 1px solid var(--sep); }
.alert-btn:hover { background: var(--hover); }
.alert-btn.is-default { font-weight: 600; }
.alert-btn.is-destructive { color: var(--bad-text); }

@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* ------------------------------------------------------- Größere Fenster */

@media (min-width: 40rem) {
  .large-title { font-size: 2.5rem; }
  .q-text { font-size: 1.625rem; }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dots { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 0.55rem; }
  .sheet { margin: auto; max-width: 36rem; border-radius: 1.25rem; padding-bottom: 1.25rem; }
  .sheet-grabber { display: none; }
  .sheet[open] { animation: pop 0.22s ease-out; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
