:root {
  --bg: #f6f7f5;
  --card: #ffffff;
  --text: #1f2a24;
  --muted: #5c6a62;
  --line: #d5dbd6;
  --accent: #2f6b45;
  --accent-text: #ffffff;
  --accent-soft: #e3efe6;
  --error: #a3261d;
  --error-soft: #fbe9e7;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

h1 { font-size: 1.35rem; line-height: 1.3; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.5rem; }
/* Titel einzeilig und so breit wie der Inhalt; app.js passt die Schrift exakt an, das hier ist der Rückfall ohne JS */
.title { white-space: nowrap; font-size: min(1.35rem, calc((100vw - 2rem) * 0.0375)); }
p { margin: 0 0 1rem; }

.meta, .hint, .scale-labels { color: var(--muted); font-size: 0.9rem; }

.notice {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

/* Startseite in Bereiche gliedern: Einleitung | Hinweis + Bestätigung | Zugangscode */
.start-form .check { margin-bottom: 2rem; }
.notice { margin-top: 2rem; }

.error {
  background: var(--error-soft);
  color: var(--error);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

/* Formulare */
label { display: block; font-weight: 600; margin-bottom: 0.35rem; }

input[type="text"], input[type="password"], textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 0.75rem;
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
input:focus, textarea:focus, .btn:focus-visible, .check input:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 1px;
  border-color: var(--accent);
}

.start-form input[type="text"], .start-form input[type="password"] { margin-bottom: 1rem; }
.start-form #code { letter-spacing: 0.15em; }
input:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
.start-form label:has(+ input:disabled) { color: var(--muted); }

.check {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-weight: 400;
  margin: 0 0 1rem;
  cursor: pointer;
}
.check input { width: 22px; height: 22px; margin: 0.15rem 0 0; flex: none; accent-color: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 48px;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
}
/* Nur bei echter Maus, sonst bleibt der Rahmen nach dem Tippen auf dem Handy am Button der nächsten Frage hängen */
@media (hover: hover) { .btn:hover:not(:disabled) { border-color: var(--accent); } }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); width: 100%; }
.btn.choice.selected { background: var(--accent); color: var(--accent-text); border-color: var(--accent); opacity: 1; }

.choices { display: grid; gap: 0.6rem; margin-bottom: 0.5rem; }
.choices.scale { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.choices.scale .btn { min-height: 56px; font-size: 1.2rem; padding: 0; }
.choices.list .btn { width: 100%; justify-content: flex-start; text-align: left; }

.scale-labels { display: flex; justify-content: space-between; gap: 1rem; }
.scale-labels span:last-child { text-align: right; }

.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 0.75rem; }

/* Altersregler */
.range-value { text-align: center; font-size: 1.1rem; color: var(--muted); margin-bottom: 0.5rem; }
.range-number { display: inline-block; min-width: 2ch; font-size: 2.2rem; font-weight: 700; color: var(--text); }
.range { display: block; width: 100%; height: 48px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.range:not(.touched) { opacity: 0.6; }
.range + .scale-labels { margin-bottom: 1.25rem; }

/* Fragen */
.progress {
  display: block;
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
  appearance: none;
}
.progress::-webkit-progress-bar { background: var(--line); }
.progress::-webkit-progress-value { background: var(--accent); }
.progress::-moz-progress-bar { background: var(--accent); }

.meta { margin: 0.5rem 0 0; }
/* Fester Bereich für den Fragentext, damit die Antwortbuttons auf jeder Seite an derselben Stelle stehen */
.question-head { display: flow-root; margin: 1rem 0 1.25rem; min-height: 11rem; }
@media (min-width: 390px) { .question-head { min-height: 9.5rem; } }
@media (min-width: 700px) { .question-head { min-height: 6.5rem; } }
.question-head > :first-child { margin-top: 0; }
.question-head > :last-child { margin-bottom: 0; }

.lead { color: var(--muted); margin: 0 0 0.25rem; }
.topic { margin-bottom: 0.25rem; }
.topic-desc { color: var(--muted); margin-bottom: 1.25rem; }

.rank-list { display: grid; gap: 0.5rem; margin-bottom: 0.5rem; }
.rank-option {
  margin: 0;
  padding: 0.75rem;
  min-height: 48px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.rank-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.rank-option:has(input:disabled) { color: var(--muted); opacity: 0.55; cursor: not-allowed; }

/* Admin */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.6rem; margin-bottom: 1.25rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem 1rem; }
.stat b { display: block; font-size: 1.6rem; }
.admin-actions { display: grid; gap: 0.6rem; }
.admin-actions .btn { width: 100%; }


/* Meldungsseiten */
.message { text-align: center; padding-top: 3rem; }
.message h1 { font-size: 1.6rem; }

.test-banner {
  background: #fff3cd;
  color: #664d03;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
}
