:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #555b66;
  --line: #d5d9e0;
  --brand: #1d4e89;
  --card: #f5f7fa;
  --ok: #1b7a3a;
  --warn: #9a5b00;
  --mislead: #b34700;
  --bad: #b3261e;
  --neutral: #4a5060;
  --info: #1d4e89;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --fg: #f1f3f6;
    --muted: #aab1bd;
    --line: #353b46;
    --brand: #6ea8ee;
    --card: #1d2229;
    --ok: #62d083;
    --warn: #f0b24a;
    --mislead: #ff9a57;
    --bad: #ff8a80;
    --neutral: #b4bac6;
    --info: #8db9f5;
  }
}

* { box-sizing: border-box; }

html { font-size: 22px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0.75rem 1rem 3rem;
}

[hidden] { display: none !important; }

.top h1 {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.6rem;
  color: var(--brand);
}

.lead { font-size: 1.15rem; margin: 0.5rem 0 1rem; }
.hint { color: var(--muted); font-size: 0.85rem; }
.hint.warn { margin: 1.25rem 0; }

/* Schritte */
.steps { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 0.6rem; }
.steps li {
  display: flex; align-items: center; gap: 0.85rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 0.8rem;
  padding: 0.75rem 1rem;
}
.num {
  flex: none; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700;
  display: grid; place-items: center;
}
@media (prefers-color-scheme: dark) { .num { color: #101418; } }

/* Buttons */
.btn {
  display: block; width: 100%; min-height: 3.4rem;
  padding: 0.8rem 1rem; margin: 0.75rem 0;
  border-radius: 0.8rem; border: 2px solid var(--brand);
  font: inherit; font-weight: 700; text-align: center;
  cursor: pointer;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.secondary { background: transparent; color: var(--brand); }
@media (prefers-color-scheme: dark) { .btn.primary { color: #101418; } }

.paste { margin-top: 1.25rem; }
.paste summary { cursor: pointer; padding: 0.75rem 0; color: var(--brand); font-weight: 600; }
.paste textarea {
  width: 100%; font: inherit; padding: 0.7rem; border-radius: 0.6rem;
  border: 2px solid var(--line); background: var(--bg); color: var(--fg);
}

/* Laden */
#loading { text-align: center; padding-top: 1.5rem; }
.spinner {
  width: 4rem; height: 4rem; margin: 1rem auto;
  border: 0.45rem solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Vorschau des geprüften Beitrags + Großansicht */
.preview {
  display: flex; align-items: center; gap: 0.8rem; width: 100%;
  margin: 0.5rem 0 0; padding: 0.5rem; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 0.8rem;
  font: inherit; color: inherit; cursor: pointer;
}
.preview img {
  flex: none; width: 4.5rem; height: 4.5rem; object-fit: cover; object-position: top;
  border-radius: 0.5rem; border: 1px solid var(--line);
}
.preview-text { display: grid; gap: 0.1rem; min-width: 0; }
.preview-label { font-weight: 700; font-size: 0.9rem; }
.preview-snippet {
  font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.preview-snippet:empty { display: none; }
.preview-hint { font-size: 0.8rem; color: var(--brand); }

#viewer {
  width: min(44rem, 94vw); max-height: 92vh; padding: 0;
  border: 0; border-radius: 1rem; background: var(--bg); color: var(--fg);
}
#viewer::backdrop { background: rgba(0, 0, 0, 0.75); }
.viewer-body { padding: 0.75rem; }
#viewerImg { display: block; width: 100%; max-height: 72vh; object-fit: contain; border-radius: 0.5rem; }
#viewerText { margin: 0 0 0.5rem; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 65vh; overflow: auto; }
#viewerText:empty { display: none; }
#viewerImg:not([hidden]) + #viewerText { margin-top: 0.75rem; }

/* Urteil */
.verdict {
  margin: 0.75rem 0 1rem; padding: 1rem;
  border-radius: 1rem; border: 3px solid var(--tone, var(--neutral));
}
.verdict-top { display: flex; align-items: center; gap: 0.8rem; }
.verdict-icon {
  flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  background: var(--tone, var(--neutral)); color: #fff;
  display: grid; place-items: center; font-size: 1.5rem; font-weight: 800;
}
@media (prefers-color-scheme: dark) { .verdict-icon { color: #101418; } }
.verdict-label { font-size: 1.3rem; font-weight: 800; color: var(--tone, var(--neutral)); line-height: 1.2; }
.verdict-headline { font-size: 1.6rem; font-weight: 800; line-height: 1.25; margin-top: 0.7rem; }

.verdict[data-v="stimmt"] { --tone: var(--ok); }
.verdict[data-v="teilweise"] { --tone: var(--warn); }
.verdict[data-v="irrefuehrend"] { --tone: var(--mislead); }
.verdict[data-v="falsch"] { --tone: var(--bad); }
.verdict[data-v="meinung"] { --tone: var(--info); }
.verdict[data-v="nicht_belegbar"], .verdict[data-v="nicht_pruefbar"] { --tone: var(--neutral); }

.claim { margin: 0 0 1rem; color: var(--muted); font-size: 0.9rem; }
.claim-label { font-weight: 700; }

/* Punkte */
.points { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.6rem; }
.point {
  display: flex; align-items: flex-start; gap: 0.7rem;
  padding: 0.65rem 0.8rem; border-radius: 0.8rem;
  background: var(--card); border: 1px solid var(--line);
  border-left: 0.4rem solid var(--ptone);
}
.point[data-t="stimmt"] { --ptone: var(--ok); }
.point[data-t="falsch"] { --ptone: var(--bad); }
.point[data-t="fehlt"] { --ptone: var(--warn); }
.point .tag {
  flex: none; min-width: 4.4rem; margin-top: 0.2rem; padding: 0.12rem 0.4rem;
  border-radius: 0.4rem; background: var(--ptone); color: #fff;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.05em; text-align: center;
}
@media (prefers-color-scheme: dark) { .point .tag { color: #101418; } }
.point .ptext { font-size: 1rem; line-height: 1.4; }

.point.big {
  flex-direction: column; gap: 0.5rem; padding: 1rem;
  border: 3px solid var(--ptone); border-left-width: 0.7rem;
  background: color-mix(in srgb, var(--ptone) 10%, var(--bg));
}
.point.big .tag { margin-top: 0; font-size: 0.8rem; padding: 0.2rem 0.6rem; }
.point.big .ptext { font-size: 1.35rem; font-weight: 700; line-height: 1.35; }

/* Karten */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 1rem; padding: 0.9rem 1rem; margin: 0.9rem 0;
}
.card h2 { margin: 0 0 0.4rem; font-size: 1.05rem; color: var(--brand); }
.card p { margin: 0; white-space: pre-line; }

.thread { display: grid; gap: 0.9rem; }
.thread:not(:empty) { margin-bottom: 0.6rem; }
.qa-q { font-weight: 700; color: var(--brand); }
.qa-a p { margin: 0 0 0.6rem; }
.qa-a.pending { color: var(--muted); }
.qa-a.error { color: var(--bad); }
.qa-a .sources { margin-top: 0.8rem; }
#question {
  display: block; width: 100%; margin-top: 0.4rem; font: inherit; padding: 0.7rem;
  border-radius: 0.6rem; border: 2px solid var(--line); background: var(--bg); color: var(--fg);
}
.btn:disabled { opacity: 0.5; cursor: default; }

.tricks, .sources { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.8rem; }
.tricks li { border-left: 0.35rem solid var(--brand); padding-left: 0.8rem; }
.trick-name { font-weight: 700; }
.trick-question { font-size: 0.95rem; }

.sources a {
  display: block; padding: 0.8rem 1rem; min-height: 3rem;
  border: 2px solid var(--brand); border-radius: 0.8rem;
  color: var(--brand); font-weight: 600; text-decoration: none; word-break: break-word;
}
.sources .host { display: block; font-weight: 400; font-size: 0.8rem; color: var(--muted); }

/* Druck / "Als PDF speichern": Farben behalten, nichts mittendrin zerreißen, Bedienelemente weglassen */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .btn, #cancel, #question, #viewer { display: none !important; }
  .verdict, .point, .card, .sources li, .tricks li { break-inside: avoid; }
}
