/* =========================================================================
   VGF Fahrschule – Stylesheet
   CI-Basis: VGF-Petrol #009CA6 (Hausfarbe der VGF)
   Mobile-first, mit sanftem Ausbau für größere Displays.
   ========================================================================= */

:root {
  /* --- VGF-Palette ---------------------------------------------------- */
  --vgf-petrol:      #009CA6;   /* Hausfarbe / Primär */
  --vgf-petrol-dark: #007880;   /* aktive Zustände, Tiefe */
  --vgf-petrol-deep: #05363a;   /* Text/Überschriften auf hell */
  --vgf-amber:       #E8820E;   /* Signal-/Sicherheitsakzent (sparsam) */

  --ink:        #14282a;        /* Fließtext */
  --muted:      #5c7375;        /* Sekundärtext */
  --paper:      #ffffff;
  --surface:    #f1f6f6;        /* Flächen/Karten-Hintergrund */
  --surface-2:  #e6efef;
  --line:       #d4e0e0;        /* Trennlinien/Rahmen */

  --correct:    #237a48;
  --correct-bg: #e4f3ea;
  --wrong:      #b8352f;
  --wrong-bg:   #fbe8e7;

  /* --- Maße ----------------------------------------------------------- */
  --wrap:   680px;              /* Lesebreite */
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px;                  /* Mindest-Touchfläche */
  --header-h: 56px;

  --shadow: 0 1px 2px rgba(5,54,58,.06), 0 6px 20px rgba(5,54,58,.06);

  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* füllt Notch/Safe-Area unten auf iOS */
  min-height: 100dvh;
}

h1, h2, h3 { color: var(--vgf-petrol-deep); line-height: 1.2; margin: 0; }

button { font-family: inherit; }

/* ===== App-Header ======================================================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--vgf-petrol);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 6px;
  padding-right: 12px;
  box-shadow: 0 2px 10px rgba(5,54,58,.18);
}

.app-header__back {
  width: var(--tap);
  height: var(--tap);
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.app-header__back:active { background: rgba(255,255,255,.16); }
.app-header__back svg { width: 24px; height: 24px; display: block; }
.app-header__back[hidden] { display: none; }

.app-header__titles { min-width: 0; flex: 1 1 auto; }
.app-header__eyebrow {
  font-size: .72rem;
  color: rgba(255,255,255,.82);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header__title {
  font-size: 1.02rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* VGF-Wortmarke */
.wordmark {
  font-weight: 800;
  letter-spacing: .06em;
  color: #fff;
}
.wordmark b { color: var(--vgf-amber); font-weight: 800; }

/* ===== Layout-Container ================================================= */
.view {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
}

/* ===== Startseite ====================================================== */
.hero {
  background: linear-gradient(160deg, var(--vgf-petrol) 0%, var(--vgf-petrol-dark) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.hero__kicker { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.85); }
.hero h1 { color: #fff; font-size: 1.5rem; margin: 6px 0 6px; }
.hero p { margin: 0; color: rgba(255,255,255,.9); font-size: .95rem; }

.section-label {
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 4px 2px 12px;
}

/* Karten-Liste */
.cards { display: flex; flex-direction: column; gap: 12px; }

.card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color .12s ease, transform .04s ease;
  color: inherit;
}
.card:active { transform: scale(.995); }
.card:hover { border-color: var(--vgf-petrol); }

.card__body { flex: 1 1 auto; min-width: 0; }
.card__title { font-size: 1.05rem; font-weight: 700; color: var(--vgf-petrol-deep); }
.card__meta { font-size: .85rem; color: var(--muted); margin-top: 3px; }
.card__chevron { flex: 0 0 auto; color: var(--vgf-petrol); }
.card__chevron svg { width: 22px; height: 22px; display: block; }

/* Fortschritts-Chip auf Karten */
.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: .78rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--vgf-petrol-deep);
  white-space: nowrap;
}
.chip--empty { background: var(--surface-2); color: var(--muted); font-weight: 600; }

/* ===== Modulübersicht ================================================== */
.module-intro { margin-bottom: 20px; }
.module-intro h1 { font-size: 1.35rem; }
.module-intro p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }

/* Primär-Button (z. B. „Gesamttest starten“) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}
.btn--primary { background: var(--vgf-petrol); color: #fff; box-shadow: var(--shadow); }
.btn--primary:active { background: var(--vgf-petrol-dark); }
.btn--ghost { background: var(--paper); color: var(--vgf-petrol-deep); border-color: var(--line); }
.btn--ghost:active { background: var(--surface); }
.btn--block { margin-bottom: 18px; }

.btn__hint { font-weight: 500; font-size: .82rem; opacity: .85; }

/* ===== Test / Frage ==================================================== */
.quiz-top {
  position: sticky;
  top: calc(var(--header-h) + env(safe-area-inset-top));
  z-index: 10;
  background: var(--surface);
  padding: 12px 16px 10px;
  margin: 0 auto;
  max-width: var(--wrap);
}
.quiz-top__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.quiz-count { font-size: .85rem; font-weight: 700; color: var(--vgf-petrol-deep); }
.quiz-cancel {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
  margin: -8px -8px -8px 0;
  text-decoration: underline;
}

.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress__bar { height: 100%; background: var(--vgf-petrol); border-radius: 999px; transition: width .25s ease; }

.question { margin-top: 6px; }
.question__text {
  font-size: 1.16rem;
  font-weight: 700;
  color: var(--vgf-petrol-deep);
  margin: 6px 0 18px;
  line-height: 1.35;
}

.answers { display: flex; flex-direction: column; gap: 10px; }

.answer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  min-height: var(--tap);
  padding: 13px 15px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.answer:hover { border-color: var(--vgf-petrol); }
.answer__marker {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid; place-items: center;
  font-size: .82rem; font-weight: 800; color: var(--muted);
  margin-top: 1px;
}
.answer__text { flex: 1 1 auto; }
.answer__icon { flex: 0 0 auto; width: 22px; height: 22px; display: none; }
.answer__icon svg { width: 100%; height: 100%; display: block; }

/* Zustände nach dem Antworten */
.answers.is-locked .answer { cursor: default; }
.answers.is-locked .answer:hover { border-color: var(--line); }

.answer.is-correct {
  border-color: var(--correct);
  background: var(--correct-bg);
}
.answer.is-correct .answer__marker { border-color: var(--correct); color: var(--correct); }
.answer.is-correct .answer__icon { display: block; color: var(--correct); }

.answer.is-wrong {
  border-color: var(--wrong);
  background: var(--wrong-bg);
}
.answer.is-wrong .answer__marker { border-color: var(--wrong); color: var(--wrong); }
.answer.is-wrong .answer__icon { display: block; color: var(--wrong); }

/* Begründung */
.explain {
  margin-top: 16px;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-left: 4px solid var(--vgf-petrol);
}
.explain__head { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; margin-bottom: 4px; }
.explain--ok  { border-left-color: var(--correct); }
.explain--ok  .explain__head { color: var(--correct); }
.explain--no  { border-left-color: var(--wrong); }
.explain--no  .explain__head { color: var(--wrong); }
.explain p { margin: 0; font-size: .95rem; color: var(--ink); }

.quiz-actions { margin-top: 18px; }

/* ===== Ergebnis ======================================================== */
.result { text-align: center; }
.scorewheel {
  --deg: 0deg;
  width: 168px; height: 168px;
  margin: 8px auto 18px;
  border-radius: 50%;
  background: conic-gradient(var(--vgf-petrol) var(--deg), var(--surface-2) 0);
  display: grid; place-items: center;
  position: relative;
}
.scorewheel::before {
  content: "";
  position: absolute; inset: 14px;
  background: var(--surface);
  border-radius: 50%;
}
.scorewheel__num { position: relative; font-size: 2.2rem; font-weight: 800; color: var(--vgf-petrol-deep); line-height: 1; }
.scorewheel__den { position: relative; font-size: .9rem; color: var(--muted); margin-top: 4px; }

.result__headline { font-size: 1.3rem; margin-bottom: 4px; }
.result__sub { color: var(--muted); margin: 0 0 22px; }
.result__actions { display: flex; flex-direction: column; gap: 10px; }

.result--pass .scorewheel { --ring: var(--correct); }

/* Wiederholung falscher Fragen – kleine Liste */
.review { text-align: left; margin-top: 26px; }
.review h3 { font-size: 1rem; margin-bottom: 10px; }
.review__item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--wrong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.review__q { font-weight: 700; color: var(--vgf-petrol-deep); font-size: .95rem; margin-bottom: 6px; }
.review__a { font-size: .9rem; margin: 2px 0; }
.review__a b { color: var(--correct); }

/* ===== Modal (Abbrechen bestätigen) ==================================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,54,58,.42);
  display: grid; place-items: center;
  padding: 22px;
  z-index: 50;
}
.modal {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 22px 20px;
  width: 100%; max-width: 360px;
  box-shadow: 0 20px 50px rgba(5,54,58,.3);
}
.modal h3 { font-size: 1.12rem; margin-bottom: 6px; }
.modal p { margin: 0 0 18px; color: var(--muted); font-size: .95rem; }
.modal__actions { display: flex; flex-direction: column; gap: 10px; }

/* ===== Footer-Vermerk ================================================== */
.footnote {
  text-align: center;
  color: var(--muted);
  font-size: .72rem;
  margin-top: 26px;
  line-height: 1.5;
}

/* ===== Motion-Präferenz respektieren =================================== */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ===== Etwas mehr Luft ab Tablet ====================================== */
@media (min-width: 560px) {
  .hero h1 { font-size: 1.7rem; }
  .result__actions, .modal__actions { flex-direction: row; justify-content: center; }
  .result__actions .btn, .modal__actions .btn { width: auto; min-width: 150px; }
}

/* sichtbarer Fokus für Tastatur/Screenreader */
:focus-visible {
  outline: 3px solid var(--vgf-amber);
  outline-offset: 2px;
  border-radius: 6px;
}
