:root {
  --primary: #c1613b;
  --primary-dark: #7a3b22;
  --accent: #e8974a;
  --accent-2: #d9822e;
  --bio: #6b7a5e;
  --bio-dark: #46523c;
  --chem: #3d6f8f;
  --chem-dark: #284a5f;
  --history: #6b4a8a;
  --history-dark: #45305c;
  --sport: #4f7a4a;
  --sport-dark: #33512f;
  --bg: #fbf6ee;
  --card: #ffffff;
  --text: #3a2a22;
  --text-muted: #8a7264;
  --border: #ede0cd;
  --theme: var(--primary);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

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

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

header.site-header {
  background: var(--theme);
  color: #fff;
  padding: 22px 0;
  transition: background 0.25s ease;
}

header.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}

.brand-name {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-sub {
  font-size: 0.85rem;
  color: #f3dcc8;
  font-weight: 400;
}

.site-search {
  position: relative;
  flex: 1 1 200px;
  max-width: 300px;
}

.site-search input {
  width: 100%;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.site-search input::placeholder {
  color: #f6e4d2;
}

.site-search input:focus {
  outline: none;
  background: #fff;
  color: var(--text);
}

.site-search input:focus::placeholder {
  color: var(--text-muted);
}

.site-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(58, 42, 34, 0.18);
  overflow: hidden;
  z-index: 30;
  display: none;
}

.site-search-results.open {
  display: block;
}

.site-search-results a {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.site-search-results a:last-child {
  border-bottom: none;
}

.site-search-results a:hover {
  background: var(--bg);
}

.site-search-results a .cat {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.site-search-results .no-results {
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

nav.site-nav a {
  color: #f6e4d2;
  text-decoration: none;
  margin-left: 18px;
  font-size: 0.95rem;
  font-weight: 600;
}

nav.site-nav a:hover { color: #fff; }

main { padding: 40px 0 60px; }

.hero {
  text-align: center;
  padding: 30px 0 10px;
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 8px;
  color: var(--theme);
  transition: color 0.25s ease;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 560px;
  margin: 0 auto;
}

.category-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 28px 0 8px;
  flex-wrap: wrap;
}

.category-tabs a {
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
}

.category-tabs a.math { border-color: var(--primary); }
.category-tabs a.physics { border-color: var(--accent-2); }
.category-tabs a.bio { border-color: var(--bio); }
.category-tabs a.chem { border-color: var(--chem); }
.category-tabs a.history { border-color: var(--history); }
.category-tabs a.sport { border-color: var(--sport); }

.category-tabs a.active-tab.math { background: var(--primary); color: #fff; }
.category-tabs a.active-tab.physics { background: var(--accent-2); color: #fff; }
.category-tabs a.active-tab.bio { background: var(--bio); color: #fff; }
.category-tabs a.active-tab.chem { background: var(--chem); color: #fff; }
.category-tabs a.active-tab.history { background: var(--history); color: #fff; }
.category-tabs a.active-tab.sport { background: var(--sport); color: #fff; }

h2.section-title {
  margin-top: 44px;
  margin-bottom: 16px;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tag-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.tag-dot.math { background: var(--primary); }
.tag-dot.physics { background: var(--accent-2); }
.tag-dot.bio { background: var(--bio); }
.tag-dot.chem { background: var(--chem); }
.tag-dot.history { background: var(--history); }
.tag-dot.sport { background: var(--sport); }

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.topic-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.topic-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(193, 97, 59, 0.15);
}

.topic-card .k {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}

.topic-card h3 {
  margin: 6px 0 0;
  font-size: 1.05rem;
  color: var(--primary);
}

.topic-card.physics h3 { color: var(--accent-2); }
.topic-card.bio h3 { color: var(--bio-dark); }
.topic-card.chem h3 { color: var(--chem); }
.topic-card.history h3 { color: var(--history-dark); }
.topic-card.sport h3 { color: var(--sport-dark); }

.topic-card.coming-soon {
  opacity: 0.55;
  cursor: default;
}

.topic-card.coming-soon:hover {
  transform: none;
  box-shadow: none;
}

/* Topic page */
.breadcrumbs {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.breadcrumbs a { color: var(--text-muted); }

article.topic h1 {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 6px;
}

.subject-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 999px;
  color: #fff;
  margin-bottom: 14px;
}

.subject-pill.math { background: var(--primary); }
.subject-pill.physics { background: var(--accent-2); }
.subject-pill.bio { background: var(--bio); }
.subject-pill.chem { background: var(--chem); }
.subject-pill.history { background: var(--history); }
.subject-pill.sport { background: var(--sport); }

article.topic.cat-bio h1 { color: var(--bio-dark); }
article.topic.cat-bio .back-link { color: var(--bio-dark); }
article.topic.cat-physics h1 { color: var(--accent-2); }
article.topic.cat-physics .back-link { color: var(--accent-2); }
article.topic.cat-chem h1 { color: var(--chem-dark); }
article.topic.cat-chem .back-link { color: var(--chem-dark); }
article.topic.cat-history h1 { color: var(--history-dark); }
article.topic.cat-history .back-link { color: var(--history-dark); }
article.topic.cat-sport h1 { color: var(--sport-dark); }
article.topic.cat-sport .back-link { color: var(--sport-dark); }

.formula-box {
  background: var(--primary-dark);
  color: #fff;
  border-radius: 14px;
  padding: 22px 26px;
  font-size: 1.5rem;
  text-align: center;
  margin: 24px 0;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.formula-box small {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  color: #e8cbb0;
  margin-top: 8px;
}

.example-box {
  background: #fff9ec;
  border: 1px solid #f1e0b8;
  border-radius: 12px;
  padding: 18px 22px;
  margin: 20px 0;
}

.example-box .label {
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.diagram {
  text-align: center;
  margin: 26px 0;
}

.diagram svg {
  width: 100%;
  max-width: 640px;
  height: auto;
}

.note {
  font-size: 0.9rem;
  color: var(--text-muted);
  border-left: 3px solid var(--border);
  padding-left: 14px;
  margin: 22px 0;
}

.ad-slot {
  margin: 30px 0;
  text-align: center;
  min-height: 90px;
}

.video-callout {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.video-callout p {
  margin: 0;
}

.video-callout .video-btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 999px;
  white-space: nowrap;
}

.video-callout .video-btn:hover {
  background: var(--primary-dark);
}

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.back-link {
  display: inline-block;
  margin-top: 30px;
  font-weight: 700;
  text-decoration: none;
}

/* Comic dialogue */
.dialog-intro {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 30px 0 14px;
}

.dialog {
  margin: 0 0 28px;
}

.dialog-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.dialog-line.right {
  flex-direction: row-reverse;
}

.dialog-avatar {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
}

.dialog-bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px 18px 18px 18px;
  padding: 12px 16px;
  max-width: 76%;
}

.dialog-line.right .dialog-bubble {
  background: var(--primary);
  border-color: var(--primary);
  border-radius: 18px 4px 18px 18px;
  color: #fff;
}

.dialog-name {
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-2);
  margin-bottom: 4px;
}

.dialog-line.right .dialog-name {
  color: #f6e4d2;
}

.dialog-bubble p {
  margin: 0;
}

.lang-switch {
  display: flex;
  gap: 4px;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  margin-left: 14px;
}

.lang-switch a, .lang-switch span {
  color: #f6e4d2;
  text-decoration: none;
  padding: 2px 5px;
  border-radius: 5px;
}

.lang-switch span.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

.lang-switch a:hover {
  color: #fff;
}

/* Polished visual layer */
:root {
  --bg: #f6f1e8;
  --card: rgba(255, 255, 255, 0.88);
  --text: #2d2520;
  --text-muted: #786c63;
  --border: rgba(125, 91, 67, 0.16);
  --shadow-soft: 0 18px 45px rgba(82, 53, 34, 0.09);
  --shadow-hover: 0 22px 50px rgba(82, 53, 34, 0.16);
}

body {
  background:
    radial-gradient(circle at 12% 4%, rgba(232, 151, 74, 0.12), transparent 28rem),
    radial-gradient(circle at 88% 19%, rgba(107, 74, 138, 0.08), transparent 30rem),
    var(--bg);
}

.container { max-width: 1080px; }

header.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 16px 0;
  background: color-mix(in srgb, var(--theme) 92%, #241c18 8%);
  box-shadow: 0 8px 24px rgba(57, 35, 22, 0.14);
}

header.site-header::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image: radial-gradient(rgba(255, 255, 255, .45) .7px, transparent .7px);
  background-size: 11px 11px;
}

header.site-header .container { position: relative; z-index: 1; }
.brand-name { letter-spacing: -0.04em; }
.brand-sub { color: rgba(255, 245, 235, .78); }

main { padding: 58px 0 84px; }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 54px 28px 28px;
  border: 1px solid rgba(193, 97, 59, .12);
  border-radius: 30px;
  background: linear-gradient(145deg, rgba(255,255,255,.88), rgba(255,248,237,.58));
  box-shadow: var(--shadow-soft);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .48;
  background-image: linear-gradient(rgba(193,97,59,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(193,97,59,.055) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, #000, transparent 78%);
}

.hero h1 {
  margin-top: 0;
  font-size: clamp(2.45rem, 5vw, 4.2rem);
  letter-spacing: -0.055em;
  line-height: 1.05;
  text-wrap: balance;
}

.hero p { max-width: 680px; font-size: 1.12rem; }

.hero-visual {
  width: min(760px, 100%);
  margin: 26px auto 2px;
}

.hero-visual svg { display: block; width: 100%; height: auto; }

.category-tabs { margin: 22px 0 2px; gap: 10px; }

.category-tabs a {
  padding: 10px 17px;
  background: rgba(255,255,255,.7);
  box-shadow: 0 6px 16px rgba(80, 51, 32, .06);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.category-tabs a:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(80, 51, 32, .12); }

h2.section-title {
  position: relative;
  margin-top: 58px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border);
  font-size: 1.55rem;
  letter-spacing: -0.025em;
}

h2.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 76px;
  height: 3px;
  border-radius: 99px;
  background: currentColor;
  opacity: .82;
}

.topic-grid { gap: 20px; }

.topic-card {
  position: relative;
  min-height: 154px;
  overflow: hidden;
  padding: 21px 22px;
  border: 1px solid rgba(125, 91, 67, .14);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(255,255,255,.68));
  box-shadow: 0 8px 22px rgba(82, 53, 34, .055);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.topic-card::before {
  position: absolute;
  top: 16px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 7px 14px rgba(65, 43, 28, .12);
}

.topic-card.math::before { content: "∑"; background: linear-gradient(145deg, #d47951, #a74326); }
.topic-card.physics::before { content: "ϟ"; background: linear-gradient(145deg, #efaa59, #cb7123); }
.topic-card.bio::before { content: "DNA"; background: linear-gradient(145deg, #879875, #596c4e); font-size: .65rem; letter-spacing: .04em; }
.topic-card.chem::before { content: "⚗"; background: linear-gradient(145deg, #5f96b7, #315f7a); }
.topic-card.history::before { content: "✦"; background: linear-gradient(145deg, #8d6aa9, #5c3f77); }
.topic-card.sport::before { content: "ATP"; background: linear-gradient(145deg, #6d9a63, #3f6a3a); font-size: .65rem; letter-spacing: .04em; }

.topic-card::after {
  content: "";
  position: absolute;
  right: -38px;
  bottom: -44px;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: currentColor;
  opacity: .035;
  pointer-events: none;
}

.topic-card:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--theme) 35%, transparent);
  box-shadow: var(--shadow-hover);
}

.topic-card .k { padding-right: 58px; color: var(--text-muted); }
.topic-card h3 { max-width: 86%; margin-top: 9px; line-height: 1.35; letter-spacing: -0.015em; }

.topic-card.coming-soon {
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.65), rgba(255,255,255,.65) 10px, rgba(255,250,243,.65) 10px, rgba(255,250,243,.65) 20px);
}

.diagram {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255,255,255,.9), rgba(255,250,242,.68));
  box-shadow: var(--shadow-soft);
}

.formula-box { box-shadow: 0 14px 28px rgba(84, 37, 22, .16); }
.example-box, .video-callout { box-shadow: 0 8px 20px rgba(82, 53, 34, .055); }

@media (max-width: 700px) {
  header.site-header .container { gap: 14px; }
  nav.site-nav { order: 3; width: 100%; display: flex; justify-content: space-between; gap: 8px; }
  nav.site-nav a { margin-left: 0; font-size: .82rem; }
  .site-search { max-width: none; }
  main { padding-top: 28px; }
  .hero { padding: 34px 18px 20px; border-radius: 22px; }
  .hero-visual { margin-top: 22px; }
  .topic-grid { grid-template-columns: 1fr; }
  .topic-card { min-height: 136px; }
}


/* Oberstufen-Bausteine (Sporttheorie) */
article.topic h2 {
  margin: 42px 0 12px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--sport-dark);
}
article.topic h3 {
  margin: 26px 0 8px;
  font-size: 1.08rem;
  color: var(--text);
}
article.topic h2 + p, article.topic h3 + p { margin-top: 0; }

.datatable {
  width: 100%;
  border-collapse: collapse;
  margin: 22px 0;
  font-size: 0.94rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(82, 53, 34, .055);
}
.datatable caption {
  caption-side: top;
  text-align: left;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 0 8px;
}
.datatable th, .datatable td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.datatable thead th {
  background: color-mix(in srgb, var(--sport) 14%, transparent);
  color: var(--sport-dark);
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.datatable tbody tr:last-child td { border-bottom: none; }
.datatable tbody tr:nth-child(even) { background: rgba(125, 91, 67, .035); }

.example-box.warn { background: #fff4ef; border-color: #f0cdbb; }
.example-box.warn .label { color: #b8483a; }
.example-box.phrase { background: #f2f7f0; border-color: #cfe0c8; }
.example-box.phrase .label { color: var(--sport-dark); }
.example-box.glossary { background: #fbfaf6; border-color: var(--border); }
.example-box.glossary .label { color: var(--text-muted); }
.example-box.task { background: #f4f6fb; border-color: #cdd6e8; }
.example-box.task .label { color: #3d5a8f; }

.example-box dl { margin: 0; }
.example-box dt { font-weight: 800; margin-top: 10px; color: var(--sport-dark); }
.example-box dt:first-child { margin-top: 0; }
.example-box dd { margin: 2px 0 0; }

details.solution {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
details.solution summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #3d5a8f;
}
details.solution[open] summary { margin-bottom: 10px; }

.calc {
  font-family: "Consolas", "SFMono-Regular", ui-monospace, monospace;
  background: rgba(125, 91, 67, .07);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 14px 0;
  font-size: 0.92rem;
  line-height: 1.8;
}
