/* ===========================================================
   Bewerbungstool – UI-Overhaul (Re-Skin)
   Reine Huelle: Tokens + Dark Mode. Keine Aenderung an Flows,
   IDs oder JS-relevanten Klassen. Ampel-Semantik bleibt erhalten.
   =========================================================== */

@font-face {
  font-family: "Sora";
  src: url("assets/fonts/Sora-variable.ttf") format("truetype-variations"),
       url("assets/fonts/Sora-variable.ttf") format("truetype");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Identitaet (warmes Korall/Terrakotta) */
  --primary: oklch(0.57 0.17 35);
  --primary-dark: oklch(0.50 0.17 35);
  --primary-soft: oklch(0.96 0.03 35);
  --primary-soft-border: oklch(0.86 0.07 35);
  --primary-on: #ffffff;
  --accent-text: oklch(0.54 0.17 35);

  /* Neutrale, leicht warme Flaechen */
  --bg: oklch(0.98 0.008 60);
  --card: #ffffff;
  --card-2: oklch(0.985 0.006 60);
  --text: oklch(0.30 0.015 50);
  --text-strong: oklch(0.24 0.015 50);
  --muted: oklch(0.52 0.02 50);
  --border: oklch(0.90 0.012 60);
  --border-strong: oklch(0.82 0.012 60);

  /* Ampel-Semantik (Score & Schwierigkeit) */
  --green: oklch(0.52 0.13 150);
  --green-soft: oklch(0.95 0.04 150);
  --orange: oklch(0.52 0.13 60);
  --orange-soft: oklch(0.95 0.045 62);
  --red: oklch(0.53 0.19 27);
  --red-soft: oklch(0.95 0.04 27);

  /* Kopfzeile */
  --header-bg: var(--primary);
  --header-on: #ffffff;

  /* Form & Tiefe */
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow: 0 18px 40px -18px oklch(0.45 0.04 40 / 0.20);
  --shadow-sm: 0 2px 8px -3px oklch(0.45 0.04 40 / 0.18);
  --display: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

/* Dunkel-Tokens. Greifen automatisch per System (ausser der Nutzer erzwingt
   ueber den Kopfzeilen-Schalter Hell) ODER manuell ueber [data-theme="dark"].
   Die Werte beider Bloecke muessen identisch bleiben. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --primary: oklch(0.72 0.15 38);
    --primary-dark: oklch(0.66 0.15 38);
    --primary-soft: oklch(0.33 0.06 35);
    --primary-soft-border: oklch(0.45 0.08 35);
    --primary-on: oklch(0.20 0.03 40);
    --accent-text: oklch(0.78 0.13 40);

    --bg: oklch(0.205 0.012 50);
    --card: oklch(0.25 0.015 50);
    --card-2: oklch(0.235 0.014 50);
    --text: oklch(0.90 0.01 60);
    --text-strong: oklch(0.95 0.008 60);
    --muted: oklch(0.67 0.015 55);
    --border: oklch(0.34 0.015 50);
    --border-strong: oklch(0.44 0.015 50);

    --green: oklch(0.78 0.13 150);
    --green-soft: oklch(0.31 0.05 150);
    --orange: oklch(0.80 0.12 65);
    --orange-soft: oklch(0.33 0.05 62);
    --red: oklch(0.72 0.16 27);
    --red-soft: oklch(0.34 0.06 27);

    --header-bg: oklch(0.28 0.04 35);
    --header-on: oklch(0.96 0.02 45);

    --shadow: 0 18px 44px -18px #000a;
    --shadow-sm: 0 2px 10px -4px #0008;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: oklch(0.72 0.15 38);
  --primary-dark: oklch(0.66 0.15 38);
  --primary-soft: oklch(0.33 0.06 35);
  --primary-soft-border: oklch(0.45 0.08 35);
  --primary-on: oklch(0.20 0.03 40);
  --accent-text: oklch(0.78 0.13 40);

  --bg: oklch(0.205 0.012 50);
  --card: oklch(0.25 0.015 50);
  --card-2: oklch(0.235 0.014 50);
  --text: oklch(0.90 0.01 60);
  --text-strong: oklch(0.95 0.008 60);
  --muted: oklch(0.67 0.015 55);
  --border: oklch(0.34 0.015 50);
  --border-strong: oklch(0.44 0.015 50);

  --green: oklch(0.78 0.13 150);
  --green-soft: oklch(0.31 0.05 150);
  --orange: oklch(0.80 0.12 65);
  --orange-soft: oklch(0.33 0.05 62);
  --red: oklch(0.72 0.16 27);
  --red-soft: oklch(0.34 0.06 27);

  --header-bg: oklch(0.28 0.04 35);
  --header-on: oklch(0.96 0.02 45);

  --shadow: 0 18px 44px -18px #000a;
  --shadow-sm: 0 2px 10px -4px #0008;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

header {
  background: var(--header-bg);
  color: var(--header-on);
  padding: 1rem 1.25rem;
  padding-top: calc(1rem + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.header-logo {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 11px;
}
.header-logo .field { fill: #ffffff; }
.header-logo .glyph { fill: var(--primary); }

header h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}
header h1 .brand-dot { color: oklch(0.9 0.07 45); }
header h1 .brand-tld { font-weight: 500; opacity: 0.82; }
header .subtitle { margin: 0.15rem 0 0; font-size: 0.85rem; opacity: 0.85; }

.header-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-actions button {
  color: var(--header-on);
  border-color: color-mix(in srgb, var(--header-on) 45%, transparent);
  background: transparent;
}

.header-actions button:hover {
  background: color-mix(in srgb, var(--header-on) 14%, transparent);
}

/* Farbschema-Schalter: kompakter Icon-Button (Touch-Ziel via button:not(.tab)) */
#btn-theme {
  width: 44px;
  padding: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#btn-theme svg { display: block; width: 20px; height: 20px; }

main {
  max-width: 720px;
  margin: 1.5rem auto;
  padding: 0 1rem 3rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }

h2 {
  margin-top: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--text-strong);
}
h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-strong);
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin: 0.9rem 0 0.3rem;
}

input[type="text"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: var(--primary);
}

.hint { font-size: 0.78rem; color: var(--muted); margin: 0.3rem 0 0; }

.row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-top: 1rem;
}

.row input { flex: 1; }
.row.wrap { flex-wrap: wrap; }

.settings-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0 0.5rem;
}
.space-between { justify-content: space-between; }

.field-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.field-inline label { margin: 0; }
.field-inline select { width: auto; }

button {
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

button:hover { background: var(--card-2); border-color: var(--border-strong); }
button:active { transform: translateY(1px); }

/* Touch-Ziele >= 44px (echte Buttons + Pills); Segment-Tabs bleiben auf
   Desktop schlank und werden erst im Mobile-Block auf 44px gebracht. */
button:not(.tab), .diff-option {
  min-height: 44px;
}

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-on);
  font-family: var(--display);
  font-weight: 700;
  box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--primary) 60%, transparent);
}
button.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
button.primary:disabled { opacity: 0.5; cursor: default; box-shadow: none; }

button.ghost {
  background: transparent;
  font-weight: 600;
}

/* Onboarding */
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--accent-text);
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.85rem;
  margin-right: 0.4rem;
}

#ob-steps {
  margin: 0.4rem 0 0;
  padding-left: 1.3rem;
}

#ob-steps li { margin-bottom: 0.35rem; }

#view-onboarding a, #view-settings a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Quellen-Tabs (URL oder Text) – Segmented Control */
.tabs {
  display: inline-flex;
  gap: 4px;
  border: none;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  overflow: hidden;
  margin-top: 0.6rem;
}

.tab {
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 0.5rem 1rem;
  font-weight: 600;
}

.tab:hover { background: transparent; color: var(--text); }
.tab + .tab { border-left: none; }

.tab.active {
  background: var(--card);
  color: var(--text-strong);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* Modusauswahl */
.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

@media (max-width: 540px) {
  .mode-row { grid-template-columns: 1fr; }
}

.mode-option {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 0.9rem;
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  margin: 0;
  transition: border-color 0.15s, background 0.15s;
}

.mode-option:has(input:checked) {
  border-color: var(--primary);
  border-width: 1.5px;
  background: var(--primary-soft);
}

.mode-option input {
  margin-top: 0.2rem;
  accent-color: var(--primary);
}
.mode-option strong {
  display: block;
  color: var(--text-strong);
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

/* Schwierigkeitsgrad */
.diff-row {
  display: flex;
  gap: 0.5rem;
}

.diff-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.5rem 0.9rem;
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
  margin: 0;
  transition: border-color 0.15s, background 0.15s;
}

.diff-option input { position: absolute; opacity: 0; pointer-events: none; }

.diff-option:has(input:checked) {
  border-color: var(--primary);
  border-width: 1.5px;
  background: var(--primary-soft);
  color: var(--text-strong);
  font-weight: 700;
}

.diff-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.12rem 0.55rem;
  border-radius: var(--radius-pill);
  font-family: var(--display);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

.diff-badge.leicht { background: var(--green-soft); color: var(--green); }
.diff-badge.mittel { background: var(--orange-soft); color: var(--orange); }
.diff-badge.schwer { background: var(--red-soft); color: var(--red); }

/* Quiz */
.quiz-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

#quiz-progress { font-family: var(--display); font-weight: 600; color: var(--text); }

.quiz-header-right {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

#quiz-timer {
  font-family: var(--display);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-border);
  border-radius: 8px;
  padding: 0.1rem 0.5rem;
}

#quiz-timer.warning { color: var(--orange); background: var(--orange-soft); border-color: var(--orange); }
#quiz-timer.overtime { color: var(--red); background: var(--red-soft); border-color: var(--red); }

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 1.3rem;
}

#progress-fill {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.category {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-text);
  font-weight: 700;
  margin: 0;
}

#question-text {
  margin: 0.35rem 0 1.3rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.32;
  letter-spacing: -0.01em;
  color: var(--text-strong);
  text-wrap: pretty;
  animation: fadeUp 0.32s ease both;
}

.option {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  text-align: left;
  margin-bottom: 0.55rem;
  padding: 0.95rem 1rem;
  border-radius: var(--radius);
  font-weight: 500;
  animation: fadeUp 0.3s ease both;
}

.option::before {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.option:nth-child(2) { animation-delay: 0.04s; }
.option:nth-child(3) { animation-delay: 0.08s; }
.option:nth-child(4) { animation-delay: 0.12s; }
.option:nth-child(5) { animation-delay: 0.16s; }
.option:nth-child(6) { animation-delay: 0.20s; }

.option.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
  color: var(--text-strong);
}
.option.selected::before {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 4px var(--card);
}

.option:disabled { cursor: default; opacity: 1; }

.option.correct {
  border-color: var(--green);
  background: var(--green-soft);
  font-weight: 600;
  color: var(--text-strong);
}
.option.correct::before {
  background: var(--green);
  border-color: var(--green);
  box-shadow: inset 0 0 0 4px var(--card);
}

.option.wrong {
  border-color: var(--red);
  background: var(--red-soft);
}
.option.wrong::before {
  background: var(--red);
  border-color: var(--red);
  box-shadow: inset 0 0 0 4px var(--card);
}

/* Lernmodus */
#learn-area { margin-top: 0.7rem; }

#btn-reveal {
  width: 100%;
  border: 1px dashed var(--primary-soft-border);
  background: var(--primary-soft);
  color: var(--accent-text);
  font-weight: 600;
}
#btn-reveal:hover { background: var(--primary-soft); border-color: var(--primary); }

.learn-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  font-size: 0.9rem;
  background: var(--card-2);
}

.learn-box p { margin: 0 0 0.6rem; }
.learn-box p:last-child, .learn-box ul:last-child { margin-bottom: 0; }

.learn-answer { font-family: var(--display); font-weight: 700; color: var(--accent-text); }

.option-explanations {
  margin: 0 0 0.6rem;
  padding-left: 1.1rem;
}

.option-explanations li { margin-bottom: 0.25rem; }
.exp-correct { color: var(--green); }
.exp-wrong { color: var(--muted); }

.learn-sources-head {
  font-weight: 600;
  margin-bottom: 0.2rem !important;
}

.learn-box ul:not(.option-explanations) {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.learn-box a, .detail-item a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.learn-box a:hover, .detail-item a:hover { color: var(--primary-dark); }

/* Ergebnis – animierter Score-Ring */
.score-circle {
  position: relative;
  width: 152px;
  height: 152px;
  margin: 0.5rem auto 1.2rem;
  display: block;
  /* alte Kreis-Optik (Rahmen/Flex) bewusst entfernt */
  border: none;
  border-radius: 0;
}

.score-ring-svg { display: block; transform: rotate(-90deg); }
.score-ring-track { fill: none; stroke: var(--border); stroke-width: 13; }
.score-ring-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 13;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.score-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-ring-pct {
  font-family: var(--display);
  font-weight: 800;
  font-size: 2.4rem;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-strong);
}
.score-ring-pct i { font-style: normal; font-size: 1.25rem; color: var(--muted); }
.score-ring-sub {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 0.25rem;
}

.result-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

@media (max-width: 540px) {
  .result-cols { grid-template-columns: 1fr; }
}

.result-cols > div {
  border-radius: var(--radius);
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--border);
}
.result-cols > div h3 { margin-top: 0; }
.result-cols > div ul { margin: 0; padding-left: 1.1rem; font-size: 0.9rem; }
.result-cols > div:first-child { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 35%, transparent); }
.result-cols > div:first-child h3 { color: var(--green); }
.result-cols > div:last-child { background: var(--orange-soft); border-color: color-mix(in srgb, var(--orange) 35%, transparent); }
.result-cols > div:last-child h3 { color: var(--orange); }

.detail-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem 1.05rem;
  margin-bottom: 0.7rem;
}

.detail-item .q { font-weight: 600; margin: 0 0 0.3rem; color: var(--text-strong); }
.detail-item .a { margin: 0 0 0.3rem; font-size: 0.9rem; }
.detail-item .fb { margin: 0; font-size: 0.88rem; color: var(--muted); }
.detail-item .points { float: right; font-family: var(--display); font-weight: 800; }
.points.good { color: var(--green); }
.points.mid { color: var(--orange); }
.points.bad { color: var(--red); }

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: oklch(0.20 0.02 50 / 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: #fff;
  z-index: 10;
}

.loading-panel {
  background: oklch(0.27 0.02 50);
  border: 1px solid oklch(0.4 0.02 50);
  border-radius: var(--radius-lg);
  padding: 1.8rem 2.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: min(420px, 90vw);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.loading-panel p { margin: 0; }

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-bar {
  width: 280px;
  max-width: 80vw;
  height: 8px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  overflow: hidden;
}

#loading-fill {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.4s;
}

.loading-elapsed {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Modal */
.modal {
  max-width: 420px;
  margin: 0 1rem;
  color: var(--text);
}

/* Druckansicht: nur die Auswertung. Tokens hart auf Hell zwingen, damit auch
   beim Drucken im OS-Dark-Mode dunkler Text auf weissem Grund erscheint. */
@media print {
  :root {
    --bg: #fff;
    --card: #fff;
    --card-2: #fff;
    --text: #1a1a1a;
    --text-strong: #000;
    --muted: #444;
    --border: #bbb;
    --border-strong: #999;
    --primary: #b8472d;
    --accent-text: #a23f28;
    --green: #1f7a4d;
    --green-soft: #eaf5ef;
    --orange: #9a6a16;
    --orange-soft: #f6efe2;
    --red: #b23b2a;
    --red-soft: #f6e9e6;
  }
  header, #btn-settings, .row button, .row, .overlay, .error, .update-banner, .site-footer { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: none; padding: 0; box-shadow: none; margin: 0; }
  .score-ring-progress { transition: none; }
  .result-cols > div, .detail-item, .job-block { break-inside: avoid; }
}

/* Historie */
.job-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 0.8rem;
  background: var(--card);
}

.job-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
}

.job-head strong { font-family: var(--display); font-weight: 700; color: var(--text-strong); }
.job-head .hint { margin: 0.15rem 0 0; }

.trend {
  display: flex;
  gap: 5px;
  align-items: flex-end;
  height: 48px;
  margin: 0.8rem 0;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
}

.trend-bar {
  width: 16px;
  border-radius: 4px 4px 0 0;
}

.trend-bar.good { background: var(--green); }
.trend-bar.mid { background: var(--orange); }
.trend-bar.bad { background: var(--red); }

.attempt-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.attempt-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.attempt-list li span:first-child { flex: 1; color: var(--muted); }

.attempt-score { font-family: var(--display); font-weight: 800; }
.attempt-score.good { color: var(--green); }
.attempt-score.mid { color: var(--orange); }
.attempt-score.bad { color: var(--red); }

/* Mobil (Smartphones) */
@media (max-width: 600px) {
  header { padding: 0.8rem 1rem; padding-top: calc(0.8rem + env(safe-area-inset-top)); }
  header h1 { font-size: 1.1rem; }
  header .subtitle { font-size: 0.75rem; }
  .header-logo { width: 33px; height: 33px; border-radius: 9px; }
  .header-brand { gap: 0.55rem; }
  .header-actions button { padding: 0.5rem 0.75rem; font-size: 0.85rem; }

  main { margin: 0.9rem auto; padding: 0 0.7rem calc(2rem + env(safe-area-inset-bottom)); }
  .card { padding: 1.1rem; border-radius: 16px; }

  /* 16px verhindert den automatischen Zoom beim Fokussieren auf iOS */
  input[type="text"], input[type="password"], input[type="url"], select, textarea {
    font-size: 16px;
  }

  button { padding: 0.7rem 1rem; }
  .option { padding: 0.95rem 1rem; }
  #question-text { font-size: 1.2rem; }

  .diff-row { flex-wrap: wrap; }
  .diff-option { flex: 1; justify-content: center; min-width: 90px; }

  .row.space-between { flex-wrap: wrap; }
  .row.space-between .primary { flex: 1; }

  .tabs { display: flex; width: 100%; }
  .tabs .tab {
    flex: 1;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .quiz-header { flex-wrap: wrap; gap: 0.3rem; }

  .job-head { flex-direction: column; }
  .job-head button { align-self: stretch; }
  .attempt-list li { flex-wrap: wrap; }
}

/* Footer */
.site-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.2rem 1rem calc(1.6rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.site-footer p { margin: 0 0 0.4rem; }
.site-footer p:last-child { margin-bottom: 0; }
.site-footer strong { font-family: var(--display); font-weight: 700; color: var(--text); }
.footer-sep { margin: 0 0.35rem; }

.site-footer a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.site-footer a:hover { color: var(--primary-dark); }

/* Update-Hinweis */
.update-banner {
  position: fixed;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 92%;
  z-index: 12;
  font-size: 0.9rem;
}

/* Fehler */
.error {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red-soft);
  border: 1px solid var(--red);
  color: var(--red);
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  display: flex;
  gap: 1rem;
  align-items: center;
  max-width: 90%;
  z-index: 11;
}
.error button { color: var(--red); border-color: var(--red); background: transparent; }

/* Reduzierte Bewegung respektieren */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
