/* ==================================================
   Grundvariablen
================================================== */

:root {
  color-scheme: light;

  --bg: #f8f8f7;
  --surface: #fff;
  --ink: #181818;
  --muted: #686868;
  --line: #d9d9d7;
  --soft: #efefed;
  --focus: #555;

  font-family: Helvetica, Arial, sans-serif;
  font-synthesis: none;
}


/* ==================================================
   Dark Mode
================================================== */

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #141414;
  --surface: #1d1d1d;
  --ink: #f4f4f3;
  --muted: #aaa;
  --line: #404040;
  --soft: #292929;
  --focus: #ccc;
}


/* ==================================================
   Globale Styles
================================================== */

* {
  box-sizing: border-box;
}


html {
  scroll-behavior: smooth;
}


body {
  margin: 0;
  min-width: 320px;

  background: var(--bg);
  color: var(--ink);

  font-size: 16px;
  line-height: 1.55;
}


button,
input,
select {
  font: inherit;
}


button {
  cursor: pointer;
}


a {
  color: inherit;
}


/* ==================================================
   Fokus & Auswahl
================================================== */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}


::selection {
  background: var(--ink);
  color: var(--bg);
}


/* ==================================================
   Hilfsklassen
================================================== */

.hidden {
  display: none !important;
}


.shell {
  width: min(100% - 64px, 1120px);
  margin-inline: auto;
}


/* ==================================================
   Skip-Link
================================================== */

.skip {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 100;

  background: var(--ink);
  color: var(--bg);

  padding: 10px;
}


.skip:focus {
  top: 10px;
}


/* ==================================================
   Header
================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;

  border-bottom: 1px solid var(--line);
  background: var(--bg);
}


.header-inner {
  width: min(100% - 64px, 1280px);
  height: 74px;

  margin: auto;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;
}


.brand {
  text-decoration: none;

  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;

  white-space: nowrap;
}


.site-header nav {
  display: flex;
  align-items: center;

  gap: 32px;
}


.site-header nav a {
  text-decoration: none;

  font-size: 13px;
  color: var(--muted);
}


.site-header nav a[aria-current] {
  color: var(--ink);
  font-weight: 700;
}


.site-header nav a:hover,
.text-button:hover,
.footer-inner button:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}


/* ==================================================
   Theme-Schalter
================================================== */

.theme-toggle {
  width: 34px;
  height: 34px;

  display: grid;
  place-items: center;

  border: 1px solid var(--line);
  border-radius: 50%;

  background: transparent;
  color: var(--ink);

  font-size: 20px;
  line-height: 1;
}


/* ==================================================
   Typografie
================================================== */

.eyebrow,
.topic-no {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.17em;

  text-transform: uppercase;

  color: var(--muted);
}


.eyebrow span {
  margin: 0 0.5em;
}


.period {
  color: var(--muted);
}


h1,
h2,
h3,
p {
  margin-top: 0;
}


h1,
h2,
h3 {
  line-height: 1.05;
  letter-spacing: -0.055em;
  font-weight: 500;
}


h1 {
  font-size: clamp(54px, 8vw, 112px);
}


h2 {
  font-size: clamp(35px, 4vw, 58px);
}


h3 {
  font-size: clamp(28px, 3vw, 42px);
}


/* ==================================================
   Hero / Startseite
================================================== */

.hero {
  min-height: min(
    760px,
    calc(100svh - 74px)
  );

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;

  padding-top: 100px;
  padding-bottom: 68px;
}


.hero h1 {
  max-width: 1050px;

  margin: 36px 0 12px;

  overflow-wrap: anywhere;
}


.hero-sub {
  margin-bottom: 50px;

  font-size: clamp(18px, 2.2vw, 27px);
  letter-spacing: -0.03em;

  color: var(--muted);
}


.hero-note {
  width: 100%;

  margin-top: auto;
  padding-top: 26px;

  border-top: 1px solid var(--line);

  transform: translateY(40px);

  font-size: 13px;
  color: var(--muted);
}


.hero-note span {
  margin: 0 10px;
}


/* ==================================================
   Primäre Buttons
================================================== */

.primary {
  min-height: 52px;

  padding: 14px 21px;

  display: inline-flex;
  align-items: center;
  justify-content: space-between;

  gap: 46px;

  border: 1px solid var(--ink);

  background: var(--ink);
  color: var(--bg);

  font-size: 14px;
  font-weight: 700;

  transition:
    transform 0.15s,
    background 0.15s,
    color 0.15s;
}


.primary:hover {
  transform: translateY(-2px);

  background: var(--bg);
  color: var(--ink);
}


.primary.large {
  min-width: 245px;
  min-height: 66px;

  padding-inline: 25px;
}


/* ==================================================
   Quiz-Workspace
================================================== */

.workspace {
  min-height: 70vh;

  padding: 95px 0 115px;
}


.workspace-head {
  display: flex;
  align-items: end;
  justify-content: space-between;

  gap: 30px;

  margin-bottom: 40px;
}


.workspace-head h2 {
  margin: 15px 0 0;
}


.text-button {
  padding: 9px 0;

  border: 0;

  background: transparent;
  color: var(--muted);

  font-size: 13px;
}


/* ==================================================
   Karten
================================================== */

.setup,
.question-card,
.result-card {
  border: 1px solid var(--line);
  background: var(--surface);

  padding: clamp(24px, 5vw, 54px);
}


/* ==================================================
   Quiz-Einstellungen
================================================== */

.setup-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);

  gap: 25px;
}


.setup label {
  display: flex;
  flex-direction: column;

  gap: 11px;

  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}


.setup select,
.answer-input {
  width: 100%;
  min-height: 54px;

  padding: 12px 14px;

  border: 1px solid var(--line);
  border-radius: 0;

  background: var(--bg);
  color: var(--ink);
}


.setup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 35px;

  margin-top: 38px;
}


.setup-actions p {
  max-width: 330px;

  margin: 0;

  font-size: 12px;
  color: var(--muted);
}


/* ==================================================
   Quiz-Frage
================================================== */

.question-top {
  display: flex;
  justify-content: space-between;

  gap: 15px;

  padding-bottom: 20px;

  border-bottom: 1px solid var(--line);

  color: var(--muted);

  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;

  text-transform: uppercase;
}


.question-card h3 {
  margin: 36px 0 20px;
}


.question-prompt {
  max-width: 760px;

  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.6;
}


/* ==================================================
   Antwortbereich
================================================== */

.answer-wrap {
  margin-top: 40px;
}


.answer-wrap label,
.choice-legend {
  display: block;

  margin-bottom: 10px;

  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;

  text-transform: uppercase;
}


.answer-row {
  max-width: 420px;

  display: flex;
  align-items: center;

  gap: 13px;
}


.answer-unit {
  white-space: nowrap;
  color: var(--muted);
}


/* ==================================================
   Multiple Choice
================================================== */

.choice-list {
  display: grid;

  gap: 10px;

  margin: 0;
  padding: 0;

  border: 0;
}


.choice-list label {
  min-height: 54px;

  display: flex;
  align-items: center;

  gap: 12px;

  padding: 15px 17px;

  border: 1px solid var(--line);

  font-size: 15px;
}


.choice-list label:has(input:checked) {
  background: var(--soft);
  border-color: var(--ink);
}


.choice-list input {
  width: 18px;
  height: 18px;

  accent-color: var(--ink);
}


/* ==================================================
   Aktionen unter einer Frage
================================================== */

.question-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;

  margin-top: 35px;
}


.question-actions .hint {
  font-size: 12px;
  color: var(--muted);
}


/* ==================================================
   Feedback
================================================== */

.feedback {
  margin-top: 34px;
  padding-top: 28px;

  border-top: 1px solid var(--line);
}


.feedback strong {
  font-size: 21px;
}


.feedback p {
  margin: 8px 0;
}


.feedback ol,
.review-item ol {
  margin: 19px 0 0;

  padding-left: 22px;
}


.feedback li,
.review-item li {
  margin-bottom: 8px;

  padding-left: 7px;
}


.feedback .likely {
  margin-top: 18px;

  padding: 12px 18px;

  border-left: 2px solid var(--ink);

  background: var(--soft);
}


.validation {
  margin: 10px 0;

  font-size: 13px;

  color: var(--ink);
}


/* ==================================================
   Ergebnisse
================================================== */

.result-score {
  margin: 22px 0 5px;

  font-size: clamp(58px, 9vw, 112px);
  line-height: 1;
  letter-spacing: -0.07em;
}


.result-sub {
  color: var(--muted);

  font-size: 16px;
}


.result-actions {
  display: flex;
  flex-wrap: wrap;

  gap: 12px;

  margin: 30px 0;
}


.secondary {
  min-height: 52px;

  padding: 13px 20px;

  border: 1px solid var(--ink);

  background: transparent;
  color: var(--ink);
}


/* ==================================================
   Ergebnistabelle
================================================== */

.result-table {
  width: 100%;

  margin-top: 30px;

  border-collapse: collapse;
}


.result-table th,
.result-table td {
  padding: 12px 0;

  border-bottom: 1px solid var(--line);

  text-align: left;
}


.result-table td:last-child,
.result-table th:last-child {
  text-align: right;
}


/* ==================================================
   Fehlerwiederholung
================================================== */

.review-item {
  padding: 24px 0;

  border-top: 1px solid var(--line);
}


.review-item p {
  margin-bottom: 8px;
}


/* ==================================================
   Footer
================================================== */

.site-footer {
  border-top: 1px solid var(--line);
}


.footer-inner {
  min-height: 90px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;

  color: var(--muted);

  font-size: 12px;
}


.footer-inner div {
  display: flex;

  gap: 22px;
}


.footer-inner button {
  padding: 8px 0;

  border: 0;

  background: none;
  color: var(--ink);

  font-size: 12px;
}


/* ==================================================
   Themenübersicht
================================================== */

.topics-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);

  gap: 70px;

  padding-top: 85px;
  padding-bottom: 130px;
}


/* ==================================================
   Themen-Navigation
================================================== */

.topics-nav {
  position: sticky;
  top: 110px;

  align-self: start;

  display: grid;

  gap: 15px;
}


.topics-nav .eyebrow {
  margin-bottom: 14px;
}


.topics-nav a {
  text-decoration: none;

  color: var(--muted);

  font-size: 13px;
}


.topics-nav a:hover {
  color: var(--ink);
}


/* ==================================================
   Themen-Hauptbereich
================================================== */

.topics-main h1 {
  margin: 18px 0 24px;
}


.intro {
  max-width: 690px;

  font-size: 20px;
  line-height: 1.5;

  color: var(--muted);
}


.topic {
  scroll-margin-top: 110px;

  margin-top: 95px;
  padding-top: 26px;

  border-top: 1px solid var(--line);
}


.topic h2 {
  max-width: 720px;

  margin: 20px 0 30px;
}


.topic p,
.topic ol {
  max-width: 710px;

  font-size: 16px;
  line-height: 1.75;
}


.topic ol {
  padding-left: 24px;
}


.topic li {
  margin: 6px 0;

  padding-left: 8px;
}


/* ==================================================
   Definitionsübersicht
================================================== */

.definition-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;

  margin: 35px 0;

  border-top: 1px solid var(--line);
}


.definition-grid div {
  display: flex;
  flex-direction: column;

  gap: 6px;

  padding: 18px 15px 18px 0;

  border-bottom: 1px solid var(--line);
}


.definition-grid strong {
  font-size: 14px;
}


.definition-grid span {
  font-size: 13px;

  color: var(--muted);
}


/* ==================================================
   Formeln
================================================== */

.formula {
  margin: 34px 0;

  padding: 26px 30px;

  background: var(--soft);

  font-size: clamp(17px, 2vw, 23px);
  line-height: 1.6;
  letter-spacing: -0.03em;

  overflow-wrap: anywhere;
}


/* ==================================================
   Beispiele & Prüfungshinweise
================================================== */

.example,
.exam-note,
.error-note {
  margin: 24px 0;

  padding: 2px 0 2px 20px;

  border-left: 2px solid var(--ink);
}


.error-note {
  border-left-style: dashed;
}


/* ==================================================
   Lernvideo
================================================== */

.video {
  display: grid;

  gap: 6px;

  margin-top: 34px;
  padding: 22px 0;

  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}


.video span {
  color: var(--muted);

  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
}


.video a {
  text-decoration: none;

  font-size: 18px;
}


.video a:hover {
  text-decoration: underline;
}


.video small {
  color: var(--muted);

  font-size: 12px;
}


/* ==================================================
   Dialog / Impressum / Datenschutz
================================================== */

dialog {
  max-width: min(
    650px,
    calc(100vw - 32px)
  );

  max-height: 80vh;

  overflow: auto;

  padding: 35px 40px;

  border: 1px solid var(--line);

  background: var(--surface);
  color: var(--ink);

  box-shadow: 0 20px 80px #0005;
}


dialog::backdrop {
  background: #0009;
}


dialog h2 {
  font-size: 34px;
}


dialog p,
dialog li {
  font-size: 14px;
  line-height: 1.65;
}


dialog .close {
  float: right;

  border: 0;

  background: none;
  color: var(--ink);

  font-size: 24px;
}


.placeholder {
  padding: 12px;

  background: var(--soft);

  font-weight: 700;
}


.dialog-note {
  font-size: 12px;

  color: var(--muted);
}


/* ==================================================
   Responsive – Tablets & Smartphones
================================================== */

@media (max-width: 760px) {

  .shell,
  .header-inner {
    width: min(
      100% - 36px,
      1120px
    );
  }


  /* Header */

  .header-inner {
    height: 64px;
  }


  .brand {
    font-size: 11px;
    letter-spacing: -0.02em;
  }


  .site-header nav {
    gap: 15px;
  }


  .site-header nav a {
    font-size: 12px;
  }


  .theme-toggle {
    width: 32px;
    height: 32px;
  }


  /* Startseite */

  .hero {
    min-height: calc(100svh - 64px);

    padding-top: 95px;
    padding-bottom: 38px;
  }


  .hero h1 {
    margin-top: 28px;

    font-size: clamp(
      49px,
      12vw,
      76px
    );
  }


  .hero-sub {
    margin-bottom: 38px;
  }


  .hero-note {
    transform: translateY(22px);

    font-size: 12px;
  }


  /* Quiz */

  .workspace {
    padding-top: 70px;
    padding-bottom: 80px;
  }


  .workspace-head {
    flex-direction: column;
    align-items: start;

    gap: 10px;
  }


  .setup-grid {
    grid-template-columns: 1fr;
  }


  .setup-actions {
    flex-direction: column;
    align-items: start;

    gap: 15px;
  }


  .question-card h3 {
    margin-top: 28px;
  }


  .question-actions {
    flex-direction: column;
    align-items: stretch;
  }


  .question-actions .primary {
    width: 100%;
  }


  /* Themen */

  .topics-layout {
    display: block;

    padding-top: 58px;
  }


  .topics-nav {
    position: static;

    display: flex;

    overflow: auto;

    white-space: nowrap;

    gap: 22px;

    margin-bottom: 60px;
    padding-bottom: 15px;

    border-bottom: 1px solid var(--line);
  }


  .topics-nav .eyebrow {
    display: none;
  }


  .topics-main h1 {
    font-size: 68px;
  }


  .topic {
    margin-top: 75px;
  }


  .definition-grid {
    grid-template-columns: 1fr;
  }


  /* Footer */

  .footer-inner {
    flex-wrap: wrap;

    justify-content: flex-start;

    padding: 25px 0;
  }


  .footer-inner > span:last-child {
    width: 100%;
  }


  /* Dialog */

  dialog {
    padding: 25px;
  }
}


/* ==================================================
   Sehr kleine Smartphones
================================================== */

@media (max-width: 400px) {

  .brand {
    font-size: 10px;
  }


  .site-header nav {
    gap: 10px;
  }


  .site-header nav a {
    font-size: 11px;
  }


  .hero h1 {
    font-size: 47px;
  }
}


/* ==================================================
   Reduzierte Animationen
================================================== */

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }


  *,
  *::before,
  *::after {
    transition: none !important;
  }
}