:root {
  --bg: #ffffff;
  --bg-alt: #f4f7fb;
  --ink: #1f2937;
  --ink-soft: #4b5563;
  --primary: #1d4ed8;
  --primary-dark: #1e3a8a;
  --accent: #f59e0b;
  --positive: #16a34a;
  --negative: #e11d48;
  --line: #e5e7eb;
  --card-shadow: 0 2px 10px rgba(15, 23, 42, .06);
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 70px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.6;
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .6rem; }

h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  color: var(--primary-dark);
}

h3 { color: var(--primary-dark); font-size: 1.08rem; }

p { margin: 0 0 1rem; }

.lead { font-size: 1.06rem; color: var(--ink-soft); max-width: 62rem; }

a { color: var(--primary); }

.container { max-width: 1080px; margin: 0 auto; padding: 0 1rem; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: .6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.nav-brand {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.nav-brand span { color: var(--primary); }
.nav-links { display: flex; gap: .3rem; flex-wrap: wrap; }
.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: .88rem;
  padding: .4rem .55rem;
  border-radius: 8px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.nav-links a:hover { color: var(--primary); background: #eff6ff; }
.nav-toggle {
  display: none;
  background: none;
  border: 0;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--ink);
  padding: .25rem .6rem;
  border-radius: 8px;
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 55%, #3b82f6 100%);
  color: #fff;
  padding: 4.5rem 0 4rem;
}
.hero .container { max-width: 820px; text-align: left; }
.hero-kicker {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .8rem;
  color: #bfdbfe;
  margin-bottom: .75rem;
}
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); margin-bottom: 1rem; }
.hero-text { font-size: 1.1rem; color: #dbeafe; max-width: 60ch; }
.hero-text strong { color: #fff; }
.hero-actions { margin-top: 1.75rem; display: flex; gap: .75rem; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .7rem 1.35rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  font-size: .95rem;
  border: 2px solid transparent;
  cursor: pointer;
  font-family: var(--font);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #1f2937; }
.btn-primary:hover { box-shadow: 0 6px 16px rgba(245, 158, 11, .4); }
.btn-ghost { background: transparent; color: #1f2937; border-color: var(--line); }
#quiz .btn-ghost { color: #1f2937; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ---------- Sections ---------- */
.section { padding: 3rem 0; }
.section-alt { background: var(--bg-alt); }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  box-shadow: var(--card-shadow);
}
.card-plain { background: transparent; box-shadow: none; border-color: var(--line); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--card-shadow); border: 1px solid var(--line); }
.compare { border-collapse: collapse; width: 100%; min-width: 720px; background: #fff; }
.compare th, .compare td { padding: .8rem .9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); font-size: .92rem; }
.compare thead th { background: var(--primary-dark); color: #fff; font-weight: 600; }
.compare thead th:first-child { background: #16254d; }
.compare tbody tr:last-child td { border-bottom: 0; }
.compare td:first-child { font-weight: 600; background: #f8fafc; width: 14rem; }
.compare td.highlight { background: #eff6ff; }
.compare thead th.highlight { background: var(--primary); }

/* ---------- Quotes ---------- */
.quote {
  font-style: italic;
  font-size: 1.04rem;
  border-left: 4px solid var(--accent);
  padding: .4rem 0 .4rem 1.1rem;
  margin: 0 0 1rem;
  color: var(--ink);
}
.quote cite { display: block; font-style: normal; font-size: .82rem; color: var(--ink-soft); margin-top: .4rem; }
.quote-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; margin-top: 2rem; }
.quote-ghost { border-left-color: var(--primary); }

.quote-card h3 { font-size: 1rem; }
.quote-card .quote { margin-bottom: .6rem; }
.quote-text { font-size: .94rem; color: var(--ink-soft); margin-bottom: 0; }
.quote-text strong { color: var(--ink); }

/* ---------- Simulator ---------- */
.simulator {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 1.4rem;
  margin-top: 1.5rem;
}
.sim-hint { color: var(--ink-soft); font-size: .95rem; }
.sim-grid { display: grid; grid-template-columns: minmax(240px, 1fr) 1.4fr; gap: 1.5rem; align-items: center; }
.sim-controls label { display: block; margin-bottom: .9rem; font-size: .92rem; color: var(--ink-soft); }
.sim-controls output { float: right; font-weight: 700; color: var(--primary-dark); }
input[type="range"] { width: 100%; accent-color: var(--primary); height: 2rem; }
.sim-state p {
  margin: .5rem 0 0;
  padding: .7rem .9rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: .95rem;
}
.sim-state .eq { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.sim-state .ueber { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.sim-state .mangel { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.sim-chart canvas { width: 100%; height: auto; }
.chart-caption { font-size: .82rem; color: var(--ink-soft); margin-top: .5rem; }

/* ---------- Wirtschaftskreislauf ---------- */
.kreis-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1.75rem; align-items: center; margin-top: 1.5rem; }
.kreis-diagram svg { width: 100%; height: auto; }
.kreis-box { fill: #eff6ff; stroke: var(--primary); stroke-width: 2.5; }
.kreis-title { font-size: 19px; font-weight: 700; fill: var(--primary-dark); }
.kreis-sub { font-size: 11px; fill: var(--ink-soft); }
.kreis-label { font-size: 11.5px; font-weight: 600; }
.guthaben { fill: var(--negative); }
.gut { fill: var(--primary); }
.kreis-fuss { font-size: 10px; fill: var(--ink-soft); }
.kreis-arrow-geld { stroke: var(--negative); stroke-width: 2; stroke-dasharray: 6 5; }
.kreis-arrow-gut { stroke: var(--primary); stroke-width: 2; stroke-dasharray: 6 5; }

.steps { margin: 0 0 1rem; padding-left: 1.3rem; }
.steps li { margin-bottom: .5rem; }

/* ---------- BIP chart ---------- */
.chart-wrap { margin-top: 1.5rem; display: grid; gap: .35rem; }
.bip-row { display: grid; grid-template-columns: 12rem 1fr 5.5rem; gap: .6rem; align-items: center; font-size: .9rem; }
.bip-label { text-align: right; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bip-track { background: #eef2f7; border-radius: 6px; height: 20px; position: relative; }
.bip-bar { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #1d4ed8, #3b82f6); display: flex; align-items: center; }
.bip-bar.d { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bip-bar.high { background: linear-gradient(90deg, #047857, #10b981); }
.bip-value { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Rechner ---------- */
.calc label { display: block; margin-bottom: .85rem; font-size: .9rem; color: var(--ink-soft); }
.calc input[type="number"] {
  display: block;
  width: 100%;
  margin-top: .25rem;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font);
}
.calc input[type="number"]:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
.calc-formula { font-size: .85rem; background: #f0f4ff; border-radius: 8px; padding: .5rem .7rem; color: var(--primary-dark); font-weight: 600; }
.calc-result { background: var(--bg-alt); border-radius: 10px; padding: .7rem .9rem; }
.calc-result strong { color: var(--primary-dark); font-size: 1.1rem; }
.calc-note { font-size: .82rem; color: var(--ink-soft); }

/* ---------- Formeln ---------- */
.formula-card h3 { font-size: .98rem; margin-bottom: .5rem; }
.formula-box {
  font-family: "Consolas", "SF Mono", monospace;
  font-size: 1.08rem;
  background: #f0f4ff;
  border: 1px dashed var(--primary);
  color: var(--primary-dark);
  border-radius: 10px;
  padding: .7rem .8rem;
  margin: 0 0 .6rem;
  overflow-x: auto;
}
.formula-box sup, .formula-box sub { font-size: .72em; }
.formula-note { font-size: .88rem; color: var(--ink-soft); margin: 0; }
.formula-note strong { color: var(--primary-dark); }

/* ---------- Glossar ---------- */
.gloss-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.gloss-item { padding: 1rem 1.1rem; }
.gloss-item h3 { font-size: .95rem; margin-bottom: .35rem; color: var(--primary); }
.gloss-item p { font-size: .9rem; margin: 0; color: var(--ink-soft); }

/* ---------- Quiz ---------- */
.quiz-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  max-width: 46rem;
  margin: 1.5rem auto 0;
}
.quiz-q { font-size: 1.12rem; font-weight: 600; margin-bottom: 1rem; }
.quiz-opt {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg-alt);
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: .8rem .95rem;
  margin-bottom: .55rem;
  font-size: .98rem;
  font-family: var(--font);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
  min-height: 46px;
}
.quiz-opt:hover { border-color: var(--primary); }
.quiz-opt.sel { border-color: var(--primary); background: #eff6ff; font-weight: 600; }
.quiz-opt.correct { border-color: var(--positive); background: #ecfdf5; }
.quiz-opt.wrong { border-color: var(--negative); background: #fef2f2; }
.quiz-exp {
  margin-top: .9rem;
  padding: .7rem .9rem;
  border-radius: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  font-size: .9rem;
  color: #78350f;
}
.quiz-nav { display: flex; justify-content: space-between; align-items: center; max-width: 46rem; margin: 1rem auto 0; gap: .5rem; }
.quiz-result { max-width: 46rem; margin: 1.5rem auto 0; border-radius: var(--radius); padding: 1.2rem 1.5rem; background: #eff6ff; border: 1px solid #bfdbfe; }
.quiz-result h3 { margin-bottom: .4rem; }
.quiz-result .btn { margin-top: .5rem; }
.hidden { display: none; }

/* ---------- Links ---------- */
.links { list-style: none; padding: 0; margin: 0; }
.links li { margin-bottom: .55rem; padding-left: 1.1rem; position: relative; }
.links li::before { content: "▸"; position: absolute; left: 0; color: var(--primary); }

/* ---------- Footer ---------- */
.footer { background: var(--primary-dark); color: #bfdbfe; padding: 2rem 0; margin-top: 2rem; font-size: .9rem; }
.footer a { color: #fff; }

/* ---------- Responsive / Mobile ---------- */
@media (max-width: 900px) {
  .sim-grid, .kreis-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  html { scroll-padding-top: 58px; }

  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    padding: .25rem .75rem 1rem;
    border-bottom: 1px solid var(--line);
    max-height: calc(100vh - 58px);
    overflow-y: auto;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
  }
  .nav-links.open { display: flex; }
  .nav-links a { font-size: 1rem; padding: .6rem .5rem; }

  .hero { padding: 3rem 0 2.75rem; }
  .hero .container { text-align: center; }
  .hero-actions { justify-content: center; }
  .hero-text { margin: 0 auto; }

  .section { padding: 2.5rem 0; }

  /* Vergleichstabelle -> Karten */
  .table-wrap { border: 0; box-shadow: none; overflow: visible; }
  .compare, .compare tbody, .compare tr, .compare td { display: block; width: 100%; min-width: 0; }
  .compare thead { display: none; }
  .compare tr {
    margin-bottom: .9rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--card-shadow);
  }
  .compare td { border-bottom: 1px solid var(--line); }
  .compare tr:last-child td { border-bottom: 0; }
  .compare td:first-child {
    width: auto;
    background: #eff6ff;
    font-weight: 700;
    color: var(--primary-dark);
  }
  .compare td:first-child::before { display: none; }
  .compare td::before {
    content: attr(data-label);
    display: block;
    font-weight: 600;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-soft);
    margin-bottom: .15rem;
  }

  .bip-row { grid-template-columns: 6.5rem 1fr 4.4rem; font-size: .82rem; }
  .bip-label { text-align: left; }

  .btn { flex: 1 1 auto; }
  .quiz-nav .btn { flex: 0 1 auto; }
}

@media (max-width: 420px) {
  .bip-row { grid-template-columns: 5.5rem 1fr 4.2rem; font-size: .78rem; }
  .calc-result strong { font-size: 1rem; }
  .formula-box { font-size: 1rem; }
}
