/* ==========================================================================
   BG BiBA – "Testen statt Meckern" Quiz Stylesheet
   Orientiert an den offiziellen BG BiBA Brand Guidelines (Modern Athletic)
   ========================================================================== */

:root {
  /* Brand Colors (BG BiBA Official CI) */
  --biba-red: #E2322A;
  --biba-blue: #412774;
  --biba-black: #000000;
  --biba-white: #FFFFFF;

  /* Backgrounds */
  --biba-bg-bright: #F2F2F2;
  --biba-bg-dark: #111111;

  /* Semantic Mapping (Light Theme Default) */
  --color-primary: var(--biba-blue);
  --color-accent: var(--biba-red);
  --color-text: var(--biba-black);
  --color-text-muted: #4A4A52;
  --color-bg: var(--biba-bg-bright);
  --color-surface: var(--biba-white);
  --color-surface-subtle: #EAEAF0;
  --color-border: #D8D8E2;
  --color-badge-bg: var(--biba-blue);
  --color-badge-text: var(--biba-white);

  /* Feedback Colors (Barrierefrei & klar unterscheidbar) */
  --color-correct-bg: #DCFCE7;
  --color-correct-border: #15803D;
  --color-correct-text: #14532D;
  --color-wrong-bg: #FEE2E2;
  --color-wrong-border: #B91C1C;
  --color-wrong-text: #7F1D1D;

  /* Typography */
  --font-heading: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Layout & Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 6px 20px rgba(0, 0, 0, 0.07);

  /* Viewport-wide color scheme adaptation */
  color-scheme: light dark;

  /* Fallback for browsers without light-dark() when OS prefers dark */
  @media (prefers-color-scheme: dark) {
    --color-text: var(--biba-white);
    --color-text-muted: #C4C4CE;
    --color-bg: var(--biba-bg-dark);
    --color-surface: #1C1C1C;
    --color-surface-subtle: #26262B;
    --color-border: #34343D;
    --color-correct-bg: #052E16;
    --color-correct-border: #22C55E;
    --color-correct-text: #DCFCE7;
    --color-wrong-bg: #450A0A;
    --color-wrong-border: #F87171;
    --color-wrong-text: #FEE2E2;
    --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.45);
  }

  /* Map <meta name="color-scheme"> override back to CSS cascade */
  &:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;
    --color-text: var(--biba-white);
    --color-text-muted: #C4C4CE;
    --color-bg: var(--biba-bg-dark);
    --color-surface: #1C1C1C;
    --color-surface-subtle: #26262B;
    --color-border: #34343D;
    --color-correct-bg: #052E16;
    --color-correct-border: #22C55E;
    --color-correct-text: #DCFCE7;
    --color-wrong-bg: #450A0A;
    --color-wrong-border: #F87171;
    --color-wrong-text: #FEE2E2;
    --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.45);
  }

  &:has(> head > meta[name="color-scheme"][content="light"]) {
    color-scheme: light;
    --color-text: var(--biba-black);
    --color-text-muted: #4A4A52;
    --color-bg: var(--biba-bg-bright);
    --color-surface: var(--biba-white);
    --color-surface-subtle: #EAEAF0;
    --color-border: #D8D8E2;
    --color-correct-bg: #DCFCE7;
    --color-correct-border: #15803D;
    --color-correct-text: #14532D;
    --color-wrong-bg: #FEE2E2;
    --color-wrong-border: #B91C1C;
    --color-wrong-text: #7F1D1D;
    --shadow-card: 0 6px 20px rgba(0, 0, 0, 0.07);
  }

  @supports (color: light-dark(white, black)) {
    --color-text: light-dark(var(--biba-black), var(--biba-white));
    --color-text-muted: light-dark(#4A4A52, #C4C4CE);
    --color-bg: light-dark(var(--biba-bg-bright), var(--biba-bg-dark));
    --color-surface: light-dark(var(--biba-white), #1C1C1C);
    --color-surface-subtle: light-dark(#EAEAF0, #26262B);
    --color-border: light-dark(#D8D8E2, #34343D);
    --color-correct-bg: light-dark(#DCFCE7, #052E16);
    --color-correct-border: light-dark(#15803D, #22C55E);
    --color-correct-text: light-dark(#14532D, #DCFCE7);
    --color-wrong-bg: light-dark(#FEE2E2, #450A0A);
    --color-wrong-border: light-dark(#B91C1C, #F87171);
    --color-wrong-text: light-dark(#7F1D1D, #FEE2E2);
  }
}

/* Explicit class/attribute hook from BG BiBA Brand Guidelines */
[data-theme="dark"], .theme-dark {
  color-scheme: dark;
  --color-text: var(--biba-white);
  --color-text-muted: #C4C4CE;
  --color-bg: var(--biba-bg-dark);
  --color-surface: #1C1C1C;
  --color-surface-subtle: #26262B;
  --color-border: #34343D;
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.22;
  margin-block: 0;
  letter-spacing: -0.015em;
}

h1:focus, h2:focus {
  outline: none;
}

p {
  margin-block: 0;
}

/* Visually hidden utility (accessible to screen readers, visible on focus for skip links) */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.skip-link:is(:focus-within, :active) {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1000;
  padding: 0.65rem 1rem;
  background-color: var(--biba-red);
  color: var(--biba-white);
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

/* Accessible Focus Ring */
:where(a:any-link, button, summary):focus-visible {
  outline: 3px solid var(--biba-red);
  outline-offset: 3px;
}

/* ==========================================================================
   Header (30% Strukturfarbe: BiBA-Blau #412774 mit weißer Schrift)
   ========================================================================== */
.site-header {
  background-color: var(--biba-blue);
  color: var(--biba-white);
  border-bottom: 3px solid var(--biba-red);
}

.header-inner {
  max-width: 580px;
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* BG BiBA Logo-Regeln: 1:1 Kreisform, mind. 48x48px, mind. 10% Schutzzone */
.brand-logo-wrap {
  padding: 6px; /* > 10% Clear Space bei 52px Logo */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo {
  width: 52px;
  height: 52px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: contain;
  display: block;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-club {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--biba-white);
  line-height: 1.15;
}

.brand-initiative {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--biba-white);
  opacity: 0.92;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.14);
  color: var(--biba-white);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-sm);
  min-block-size: 44px;
  min-inline-size: 44px;
  padding: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* Branching for Theme Toggle Icon & Logo visibility without JS reliance */
.theme-option-light {
  display: none;
}

.logo-dark-only {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-option-dark {
    display: none;
  }
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-option-light {
    display: inline-flex;
  }
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .logo-light-only {
    display: none;
  }
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .logo-dark-only {
    display: block;
  }
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-option-dark {
  display: none;
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-option-light {
  display: inline-flex;
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .logo-light-only {
  display: none;
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .logo-dark-only {
  display: block;
}

/* ==========================================================================
   Main Container & Cards
   ========================================================================== */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-card);
}

.card-subtle {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
}

/* Smooth entry animation via @starting-style */
.quiz-view,
.explanation-box {
  opacity: 1;
  translate: 0 0;
  transition:
    opacity 0.25s ease-out,
    translate 0.25s ease-out;
  transition-behavior: allow-discrete;
}

@starting-style {
  .quiz-view,
  .explanation-box {
    opacity: 0;
    translate: 0 10px;
  }
}

.quiz-view[hidden],
.explanation-box[hidden] {
  display: none;
  opacity: 0;
  translate: 0 10px;
}

@media (prefers-reduced-motion: reduce) {
  .quiz-view,
  .explanation-box {
    translate: none;
    transition-duration: 0.05s;
  }
  @starting-style {
    .quiz-view,
    .explanation-box {
      translate: none;
    }
  }
}

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* BiBA-Blau mit garantiert weißer Schrift */
.badge-primary {
  background-color: var(--biba-blue);
  color: var(--biba-white);
}

.badge-outline {
  background-color: var(--color-surface-subtle);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

/* ==========================================================================
   Screen 1: Start-Screen
   ========================================================================== */
.hero-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.35rem;
}

.hero-title {
  font-size: clamp(1.45rem, 4.5vw, 1.8rem);
  font-weight: 800;
}

.hero-lead {
  color: var(--color-text-muted);
  font-size: 1rem;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem;
  background-color: var(--color-surface-subtle);
  border-radius: var(--radius-md);
}

.feature-icon {
  font-size: 1.35rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.feature-item strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.feature-item span {
  display: block;
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Buttons (10% Akzentfarbe: BiBA-Rot #E2322A mit weißer Schrift)
   ========================================================================== */
.btn {
  appearance: none;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  min-block-size: 52px;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
  width: 100%;
  transition: transform 0.1s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn:active {
  transform: scale(0.99);
}

.btn-primary {
  background-color: var(--biba-red);
  color: var(--biba-white);
}

.btn-primary:hover {
  background-color: #C5251E;
}

.btn-secondary {
  background-color: var(--biba-blue);
  color: var(--biba-white);
}

.btn-secondary:hover {
  background-color: #321D5B;
}

/* ==========================================================================
   Screen 2: Quiz-Screen
   ========================================================================== */
.progress-panel {
  margin-bottom: 0.85rem;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
}

.score-pill {
  background-color: var(--color-surface-subtle);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.82rem;
}

.quiz-progress {
  width: 100%;
  height: 10px;
  border: none;
  border-radius: 999px;
  overflow: hidden;
  background-color: var(--color-surface-subtle);
  accent-color: var(--biba-red);
}

.quiz-progress::-webkit-progress-bar {
  background-color: var(--color-surface-subtle);
  border-radius: 999px;
}

.quiz-progress::-webkit-progress-value {
  background-color: var(--biba-red);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.quiz-progress::-moz-progress-bar {
  background-color: var(--biba-red);
  border-radius: 999px;
}

.question-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.question-title {
  font-size: clamp(1.12rem, 3.6vw, 1.32rem);
  font-weight: 700;
  margin-bottom: 1.2rem;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.option-btn {
  appearance: none;
  width: 100%;
  min-block-size: 54px;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border);
  background-color: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.96rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

@media (pointer: coarse) {
  .option-btn {
    padding: 0.95rem 1rem;
  }
}

.option-btn:hover:not([aria-disabled="true"]) {
  border-color: var(--biba-blue);
  background-color: var(--color-surface-subtle);
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--biba-blue);
  color: var(--biba-white);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.option-content {
  flex: 1;
}

.option-state-tag {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  flex-shrink: 0;
  align-self: center;
}

/* Status-Darstellung nach Beantwortung (Farbe + Icon/Label) */
.option-btn.is-correct {
  background-color: var(--color-correct-bg);
  border-color: var(--color-correct-border);
  color: var(--color-correct-text);
  font-weight: 600;
}

.option-btn.is-correct .option-letter {
  background-color: var(--color-correct-border);
  color: var(--biba-white);
}

.option-btn.is-wrong {
  background-color: var(--color-wrong-bg);
  border-color: var(--color-wrong-border);
  color: var(--color-wrong-text);
}

.option-btn.is-wrong .option-letter {
  background-color: var(--color-wrong-border);
  color: var(--biba-white);
}

.option-btn[aria-disabled="true"]:not(.is-correct, .is-wrong) {
  opacity: 0.62;
  cursor: default;
}

.option-btn[aria-disabled="true"] {
  cursor: default;
}

/* Explanation Box */
.explanation-box {
  margin-top: 1.25rem;
  padding: 1.1rem;
  border-radius: var(--radius-md);
  background-color: var(--color-surface-subtle);
  border-left: 5px solid var(--biba-blue);
}

.explanation-box.is-correct-feedback {
  border-left-color: var(--color-correct-border);
}

.explanation-box.is-wrong-feedback {
  border-left-color: var(--biba-red);
}

.explanation-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

.feedback-badge {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  color: var(--biba-white);
  background-color: var(--biba-blue);
}

.is-correct-feedback .feedback-badge {
  background-color: var(--color-correct-border);
}

.is-wrong-feedback .feedback-badge {
  background-color: var(--biba-red);
}

.feedback-headline {
  font-size: 1rem;
  font-weight: 800;
}

.explanation-text {
  font-size: 0.94rem;
  margin-bottom: 0.65rem;
}

.rule-reference {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   Screen 3: Auswertung (Result)
   ========================================================================== */
.result-score-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  text-align: center;
}

.score-ring {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background-color: var(--biba-blue);
  color: var(--biba-white);
  border: 4px solid var(--biba-red);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-ring-number {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.05;
}

.score-ring-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.9;
}

.result-headline {
  font-size: clamp(1.22rem, 4vw, 1.48rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.6rem;
}

.result-subtext {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.35rem;
}

/* Wertschätzungs-Box für Schiedsrichter & Anschreiber */
.officials-box {
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  margin-bottom: 1.35rem;
}

.officials-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.officials-logo-wrap {
  padding: 6px; /* Mindestens 10% Clear Space */
  flex-shrink: 0;
}

.officials-logo {
  width: 52px;
  height: 52px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: contain;
}

.officials-title {
  font-size: 1rem;
  font-weight: 800;
}

.officials-subtitle {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.officials-text {
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.officials-cta {
  font-size: 0.88rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--color-border);
}

.officials-cta a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

/* Details / Review List */
.review-details {
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
}

.review-details summary {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0.4rem 0;
}

.review-list {
  margin: 0.85rem 0 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.review-item {
  font-size: 0.88rem;
  background-color: var(--color-surface-subtle);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
}

.review-item strong {
  display: block;
  margin-bottom: 0.25rem;
}

.review-item-answer {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.review-item-ref {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--color-border);
  background-color: var(--color-surface);
  padding: 1.1rem 1rem;
  text-align: center;
}

.footer-inner {
  max-width: 580px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.footer-brand {
  font-size: 0.88rem;
}

.footer-meta,
.footer-legal {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

