/* ============================================================
   klima.hans-lietz.de — Stylesheet
   Stil: dunkles Nachtblau, kräftige Flat-Farben, runde Formen
   (angelehnt an Kurzgesagt). Desktop-first.
   ============================================================ */

:root {
  --bg: #0a1430;
  --bg2: #0d1b3e;
  --panel: #15244f;
  --panel2: #1b2d5e;
  --line: #2a3f7a;
  --text: #eef2ff;
  --muted: #9fb0d8;
  --yellow: #ffd166;
  --orange: #ff7a59;
  --red: #ef476f;
  --teal: #06d6a0;
  --blue: #4cc9f0;
  --purple: #9b5de5;
  --radius: 22px;
  font-size: 17px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", "Segoe UI Rounded", "Segoe UI", system-ui, sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
}

h1, h2, h3, h4, .navlogo, .bigbtn, .chapnum {
  font-family: "Baloo 2", "Nunito", "Segoe UI", system-ui, sans-serif;
  line-height: 1.2;
}

::selection { background: var(--yellow); color: #0a1430; }

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

/* ---------- Navigation ---------- */
nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 1.2rem;
  padding: .55rem 2rem;
  background: rgba(10, 20, 48, .92);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--line);
}
.navlogo { font-size: 1.25rem; font-weight: 800; color: var(--yellow); text-decoration: none; white-space: nowrap; }
nav .links { display: flex; gap: .3rem; flex: 1; flex-wrap: wrap; }
nav .links a {
  color: var(--muted); text-decoration: none; font-weight: 700;
  padding: .35rem .8rem; border-radius: 99px; font-size: .92rem;
  transition: .15s;
}
nav .links a:hover, nav .links a.active { background: var(--panel2); color: var(--text); }

/* Profi-Schalter */
.level-toggle {
  display: flex; align-items: center; gap: .55rem;
  background: var(--panel); border: 2px solid var(--line);
  border-radius: 99px; padding: .25rem .45rem .25rem .9rem;
  cursor: pointer; user-select: none; font-weight: 700; font-size: .88rem;
  color: var(--muted); white-space: nowrap;
}
.level-toggle .knob {
  width: 52px; height: 26px; border-radius: 99px; background: var(--line);
  position: relative; transition: .25s;
}
.level-toggle .knob::after {
  content: "🌱"; position: absolute; left: 2px; top: 1px;
  width: 24px; height: 24px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; font-size: .75rem; transition: .25s;
}
body.profi .level-toggle .knob { background: var(--purple); }
body.profi .level-toggle .knob::after { left: 26px; content: "🚀"; }
body.profi .level-toggle { color: var(--text); border-color: var(--purple); }

/* ---------- Hero ---------- */
header.hero {
  position: relative; text-align: center;
  padding: 4.5rem 2rem 3rem; overflow: hidden;
  background: radial-gradient(ellipse at 50% -20%, #1c3270 0%, var(--bg) 65%);
}
.hero h1 { font-size: 3.4rem; font-weight: 800; }
.hero h1 .hl { color: var(--yellow); }
.hero p.sub { max-width: 640px; margin: 1rem auto 0; color: var(--muted); font-size: 1.15rem; }
.hero .earth-scene { margin: 1.6rem auto 0; max-width: 430px; }
.hero .stars span { position: absolute; border-radius: 50%; background: #fff; opacity: .7; animation: twinkle 3s infinite; }
@keyframes twinkle { 0%,100%{opacity:.15} 50%{opacity:.8} }

.chapter-cards {
  display: flex; gap: 1.3rem; justify-content: center; flex-wrap: wrap;
  margin: 2.4rem auto 0; max-width: 1100px;
}
.chapter-card {
  flex: 1 1 280px; max-width: 340px; text-align: left;
  background: var(--panel); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 1.4rem 1.5rem;
  text-decoration: none; color: var(--text);
  transition: transform .18s, border-color .18s;
}
.chapter-card:hover { transform: translateY(-6px); border-color: var(--c, var(--yellow)); }
.chapter-card .emoji { font-size: 2.3rem; }
.chapter-card h3 { color: var(--c, var(--yellow)); margin: .4rem 0 .3rem; font-size: 1.3rem; }
.chapter-card p { color: var(--muted); font-size: .95rem; }

/* ---------- Abschnitte ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 0 2rem 4rem; }

section.chapter { padding-top: 4.5rem; }
.chapter-head { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1.6rem; }
.chapnum {
  flex: 0 0 auto; width: 72px; height: 72px; border-radius: 24px;
  display: grid; place-items: center; font-size: 2rem; font-weight: 800;
  color: #0a1430; background: var(--c, var(--yellow));
  transform: rotate(-6deg);
}
.chapter-head h2 { font-size: 2.3rem; font-weight: 800; }
.chapter-head .kicker { color: var(--c, var(--yellow)); font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; }

.panel {
  background: var(--panel); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 1.7rem 1.9rem; margin: 1.4rem 0;
}
.panel h3 { font-size: 1.45rem; margin-bottom: .7rem; }
.panel h3 .picto { margin-right: .45rem; }
.panel p + p { margin-top: .75rem; }
.panel .lede { font-size: 1.06rem; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; align-items: center; }
@media (max-width: 880px) { .cols { grid-template-columns: 1fr; } }

/* Merksatz */
.merksatz {
  display: flex; gap: 1rem; align-items: center;
  background: linear-gradient(120deg, #233a78, #1b2d5e);
  border: 2px solid var(--yellow); border-radius: var(--radius);
  padding: 1.1rem 1.4rem; margin: 1.4rem 0; font-size: 1.08rem;
}
.merksatz .star { font-size: 1.9rem; }
.merksatz b { color: var(--yellow); }

/* Forscher-Wissen (Binnendifferenzierung) */
details.forscher {
  margin: 1.1rem 0 0; border: 2px dashed var(--purple);
  border-radius: 16px; background: rgba(155, 93, 229, .08);
}
details.forscher summary {
  cursor: pointer; list-style: none; padding: .8rem 1.2rem;
  font-weight: 800; color: var(--purple); font-size: 1rem;
  display: flex; align-items: center; gap: .55rem;
}
details.forscher summary::-webkit-details-marker { display: none; }
details.forscher summary::after { content: "▸"; margin-left: auto; transition: .2s; }
details.forscher[open] summary::after { transform: rotate(90deg); }
details.forscher .inner { padding: 0 1.3rem 1.1rem; color: #d9ccf5; font-size: .98rem; }
details.forscher .inner p + p { margin-top: .6rem; }

/* Glossar-Begriffe */
.gloss {
  border-bottom: 2px dotted var(--blue); cursor: help; position: relative;
  font-weight: 700; color: var(--blue);
}
#glosstip {
  position: fixed; z-index: 999; max-width: 320px;
  background: #223a78; border: 2px solid var(--blue); border-radius: 14px;
  padding: .7rem 1rem; font-size: .9rem; color: var(--text);
  box-shadow: 0 10px 30px rgba(0,0,0,.45); pointer-events: none;
  opacity: 0; transition: opacity .12s;
}
#glosstip.show { opacity: 1; }
#glosstip b { color: var(--blue); display: block; margin-bottom: .15rem; }

/* Quellen-Chips */
.srcchip {
  display: inline-block; font-size: .72rem; font-weight: 800;
  background: var(--bg2); border: 1.5px solid var(--line); color: var(--muted);
  border-radius: 99px; padding: .05rem .55rem; vertical-align: middle;
  text-decoration: none; margin-left: .3rem; white-space: nowrap;
}
.srcchip:hover { color: var(--text); border-color: var(--blue); }

/* ---------- Sortier-Spiel ---------- */
#sortgame .stage { text-align: center; }
#sortgame .card {
  margin: 1rem auto; max-width: 560px; min-height: 110px;
  background: #fff; color: #1b2440; border-radius: 18px;
  display: grid; place-items: center; padding: 1.2rem 1.6rem;
  font-size: 1.22rem; font-weight: 800;
  box-shadow: 0 12px 0 rgba(0,0,0,.28);
  transition: transform .25s, opacity .25s;
}
#sortgame .card.out { transform: translateY(-18px) rotate(3deg); opacity: 0; }
#sortgame .buckets { display: flex; gap: 1.2rem; justify-content: center; margin-top: 1.1rem; }
.bigbtn {
  border: none; cursor: pointer; border-radius: 18px;
  padding: .9rem 2.1rem; font-size: 1.15rem; font-weight: 800;
  color: #0a1430; transition: transform .12s, filter .12s;
  box-shadow: 0 6px 0 rgba(0,0,0,.3);
}
.bigbtn:hover { transform: translateY(-3px); filter: brightness(1.07); }
.bigbtn:active { transform: translateY(1px); box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.bigbtn.sun { background: var(--yellow); }
.bigbtn.sky { background: var(--blue); }
.bigbtn.go { background: var(--teal); }
.bigbtn:disabled { opacity: .45; cursor: default; transform: none; }
#sortgame .feedback { min-height: 3.2rem; margin-top: 1rem; font-weight: 700; }
#sortgame .feedback .ok { color: var(--teal); }
#sortgame .feedback .nope { color: var(--red); }
#sortgame .progress { color: var(--muted); font-size: .9rem; margin-top: .4rem; }

/* ---------- Diagramme ---------- */
.chartwrap { position: relative; margin-top: 1rem; }
canvas.chart { width: 100%; border-radius: 14px; background: var(--bg2); display: block; }
.charttip {
  position: absolute; pointer-events: none; background: #223a78;
  border: 2px solid var(--yellow); border-radius: 12px; padding: .4rem .8rem;
  font-size: .88rem; font-weight: 700; transform: translate(-50%, -120%);
  white-space: nowrap; opacity: 0; transition: opacity .1s;
}
.charttip.show { opacity: 1; }
.chartnote { color: var(--muted); font-size: .85rem; margin-top: .6rem; }

#stripes { display: flex; height: 110px; border-radius: 14px; overflow: hidden; margin-top: 1rem; cursor: crosshair; }
#stripes div { flex: 1; }
#stripeinfo { font-weight: 800; min-height: 1.6rem; margin-top: .5rem; color: var(--yellow); }

/* ---------- Treibhaus-Simulator ---------- */
#ghsim .simgrid { display: grid; grid-template-columns: 1fr 230px; gap: 1.5rem; align-items: stretch; }
@media (max-width: 880px) { #ghsim .simgrid { grid-template-columns: 1fr; } }
#ghcanvas { width: 100%; border-radius: 16px; background: linear-gradient(#03081d 0%, #0a1840 55%, #0e2150 100%); display: block; }
.simside { display: flex; flex-direction: column; gap: .9rem; justify-content: center; }
.simstat { background: var(--bg2); border: 2px solid var(--line); border-radius: 16px; padding: .8rem 1.1rem; text-align: center; }
.simstat .val { font-size: 1.9rem; font-weight: 800; font-family: "Baloo 2", sans-serif; }
.simstat.counts .val { font-size: 1.25rem; }
.simstat .lbl { color: var(--muted); font-size: .82rem; font-weight: 700; }
.simstat.temp .val { transition: color .3s; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 12px; border-radius: 99px;
  background: linear-gradient(90deg, var(--teal), var(--yellow), var(--red));
  outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 4px solid var(--bg2); box-shadow: 0 3px 8px rgba(0,0,0,.4);
}
input[type=range]::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 4px solid var(--bg2);
}
.sliderlabels { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; font-weight: 700; margin-top: .3rem; }

/* ---------- CO2-Quellen ---------- */
#sectors .bars { display: flex; flex-direction: column; gap: .65rem; margin-top: 1rem; }
.sectorrow { display: grid; grid-template-columns: 250px 1fr; gap: .9rem; align-items: center; cursor: pointer; }
.sectorrow .lab { font-weight: 700; font-size: .92rem; text-align: right; color: var(--muted); transition: color .15s; }
.sectorrow .track { background: var(--bg2); border-radius: 99px; height: 34px; position: relative; overflow: hidden; }
.sectorrow .fill {
  height: 100%; border-radius: 99px; display: flex; align-items: center;
  padding-left: .8rem; gap: .4rem; font-weight: 800; color: #0a1430;
  width: 0; transition: width 1s cubic-bezier(.2,.8,.3,1);
}
.sectorrow:hover .lab, .sectorrow.active .lab { color: var(--text); }
.sectorrow.active .track { outline: 3px solid #fff3; }
#sectorinfo {
  margin-top: 1.1rem; background: var(--bg2); border-radius: 16px;
  border-left: 6px solid var(--yellow); padding: 1rem 1.3rem; min-height: 5.2rem;
}
#sectorinfo b { font-size: 1.05rem; }
#sectorinfo p { color: var(--muted); font-size: .95rem; margin-top: .25rem; }

/* ---------- Folgen-Explorer ---------- */
.consgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; margin-top: 1rem; }
@media (max-width: 880px) { .consgrid { grid-template-columns: 1fr 1fr; } }
.conscard {
  background: var(--panel2); border: 2px solid var(--line); border-radius: 18px;
  padding: 1.1rem 1.2rem; cursor: pointer; transition: transform .15s, border-color .15s;
}
.conscard:hover { transform: translateY(-4px); border-color: var(--orange); }
.conscard.open { border-color: var(--orange); background: #243567; }
.conscard .emoji { font-size: 2rem; }
.conscard h4 { font-size: 1.08rem; margin: .35rem 0 .25rem; }
.conscard .short { color: var(--muted); font-size: .88rem; }
.conscard .long { display: none; font-size: .92rem; margin-top: .7rem; }
.conscard .src { display: none; margin-top: .6rem; font-size: .75rem; color: var(--muted); font-style: italic; }
.conscard.open .long, .conscard.open .src { display: block; }
.conscard .profitag {
  display: inline-block; background: var(--purple); color: #fff; border-radius: 99px;
  font-size: .68rem; font-weight: 800; padding: .05rem .55rem; margin-left: .4rem; vertical-align: middle;
}

/* ---------- Zukunfts-Szenarien ---------- */
#future .scenbtns { display: flex; gap: .8rem; margin-top: 1rem; flex-wrap: wrap; }
.scenbtn {
  flex: 1; min-width: 170px; border: 3px solid var(--line); background: var(--bg2);
  color: var(--text); border-radius: 16px; padding: .8rem 1rem; cursor: pointer;
  font-weight: 800; font-size: 1rem; font-family: inherit; transition: .15s;
}
.scenbtn.active { border-color: var(--c); background: var(--panel2); transform: translateY(-3px); }
#scenview { margin-top: 1.3rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: center; }
@media (max-width: 880px) { #scenview { grid-template-columns: 1fr; } }
#scensvgwrap svg { width: 100%; border-radius: 16px; }
#scenfacts .bignum { font-size: 2.6rem; font-weight: 800; font-family: "Baloo 2", sans-serif; }
#scenfacts ul { margin: .8rem 0 0 1.2rem; }
#scenfacts li { margin: .35rem 0; }
#scenfacts .ipccname { color: var(--muted); font-size: .85rem; font-weight: 700; }

/* ---------- Handeln ---------- */
.actiongrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1rem; }
@media (max-width: 880px) { .actiongrid { grid-template-columns: 1fr 1fr; } }
.actioncard { background: var(--panel2); border-radius: 18px; padding: 1.1rem; text-align: center; border-top: 6px solid var(--c, var(--teal)); }
.actioncard .emoji { font-size: 2.2rem; }
.actioncard h4 { margin: .4rem 0 .3rem; }
.actioncard p { font-size: .87rem; color: var(--muted); }

/* ---------- Quiz ---------- */
#quiz .levelpick { display: flex; gap: 1rem; margin-top: 1rem; }
#quizstage { margin-top: 1.4rem; }
#quizstage .qtext { font-size: 1.25rem; font-weight: 800; margin-bottom: 1rem; }
.quizopt {
  display: block; width: 100%; text-align: left; margin: .55rem 0;
  background: var(--bg2); border: 2px solid var(--line); color: var(--text);
  border-radius: 14px; padding: .85rem 1.2rem; font-size: 1.02rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: .12s;
}
.quizopt:hover:not(:disabled) { border-color: var(--blue); transform: translateX(4px); }
.quizopt.right { border-color: var(--teal); background: rgba(6, 214, 160, .15); }
.quizopt.wrong { border-color: var(--red); background: rgba(239, 71, 111, .15); }
#quizwhy { min-height: 3.5rem; margin-top: .8rem; color: var(--muted); font-size: .95rem; }
#quizwhy.show { color: var(--text); }
#quizprogress { color: var(--muted); font-weight: 700; font-size: .9rem; margin-bottom: .6rem; }
#quizresult { text-align: center; padding: 1.5rem 0; }
#quizresult .score { font-size: 3.2rem; font-weight: 800; font-family: "Baloo 2", sans-serif; color: var(--yellow); }

/* Konfetti */
.confetti { position: fixed; top: -20px; z-index: 500; border-radius: 3px; pointer-events: none; }

/* ---------- Quellen / Footer ---------- */
#quellen ol { margin: 1rem 0 0 1.3rem; }
#quellen li { margin: .55rem 0; font-size: .95rem; }
#quellen li b { color: var(--yellow); }
#quellen li .what { color: var(--muted); display: block; font-size: .87rem; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 2.5rem 1rem 3rem; border-top: 2px solid var(--line); margin-top: 2rem; }
footer .heart { color: var(--red); }

/* ---------- Fotos ---------- */
figure.photo { margin: 1.2rem 0 0; }
figure.photo img {
  width: 100%; border-radius: 16px; display: block;
  border: 2px solid var(--line); background: var(--bg2);
}
figure.photo figcaption {
  font-size: .88rem; color: var(--muted); margin-top: .5rem; line-height: 1.45;
}
figure.photo figcaption b { color: var(--text); }
figure.photo .credit { display: block; font-size: .74rem; opacity: .85; margin-top: .15rem; }
figure.photo .credit a { color: var(--muted); }

.photogrid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3rem; align-items: start; }
@media (max-width: 880px) { .photogrid { grid-template-columns: 1fr; } }
.photopair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.photopair img { width: 100%; border-radius: 12px; border: 2px solid var(--line); display: block; height: 230px; object-fit: cover; }
.pairlabel {
  position: absolute; top: .55rem; left: .55rem;
  background: rgba(10,20,48,.85); color: var(--yellow);
  font-weight: 800; font-size: .85rem; padding: .1rem .6rem; border-radius: 99px;
  font-family: "Baloo 2", sans-serif;
}
.pairwrap { position: relative; }

/* ---------- Video- & Sim-Embeds (Klick-zum-Laden) ---------- */
.lazyembed {
  position: relative; border-radius: 16px; overflow: hidden;
  border: 2px solid var(--line); background: var(--bg2);
  aspect-ratio: 16 / 9; cursor: pointer; margin-top: 1rem;
}
.lazyembed.phet { aspect-ratio: 4 / 3; }
.lazyembed img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .85; transition: .2s; }
.lazyembed:hover img { opacity: 1; transform: scale(1.02); }
.lazyembed .playbtn {
  position: absolute; inset: 0; margin: auto; width: 86px; height: 60px;
  background: var(--red); border: none; border-radius: 18px; cursor: pointer;
  color: #fff; font-size: 1.7rem; display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); transition: .15s;
}
.lazyembed.phet .playbtn { background: var(--purple); width: auto; padding: 0 1.3rem; font-size: 1.05rem; font-weight: 800; font-family: "Baloo 2", sans-serif; }
.lazyembed:hover .playbtn { transform: scale(1.08); }
.lazyembed .privacy {
  position: absolute; left: 0; right: 0; bottom: 0; padding: .4rem .8rem;
  background: rgba(10,20,48,.85); color: var(--muted); font-size: .74rem; text-align: center;
}
.lazyembed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.embedcap { font-size: .88rem; color: var(--muted); margin-top: .5rem; line-height: 1.45; }
.embedcap b { color: var(--text); }

video.selfhost { width: 100%; max-width: 560px; border-radius: 16px; border: 2px solid var(--line); display: block; margin: 1rem auto 0; background: #000; }

.phetgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; margin-top: .6rem; }
@media (max-width: 880px) { .phetgrid { grid-template-columns: 1fr; } }

/* ---------- Badewannen- & Albedo-Sim ---------- */
.simcanvas { width: 100%; border-radius: 16px; background: var(--bg2); display: block; }
.simrow { display: flex; gap: .9rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.simrow .simstat { flex: 1; min-width: 150px; }
.smallbtn {
  border: none; cursor: pointer; border-radius: 12px; padding: .6rem 1.2rem;
  font-size: .98rem; font-weight: 800; font-family: "Baloo 2", sans-serif;
  color: #0a1430; background: var(--teal); box-shadow: 0 4px 0 rgba(0,0,0,.3);
  transition: transform .12s;
}
.smallbtn:hover { transform: translateY(-2px); }
.smallbtn.warm { background: var(--orange); }
.smallbtn.ghost { background: var(--line); color: var(--text); }

/* ---------- Linkliste ---------- */
.linkgrid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin-top: 1rem; }
@media (max-width: 880px) { .linkgrid { grid-template-columns: 1fr; } }
.linkcard {
  display: block; background: var(--panel2); border: 2px solid var(--line);
  border-radius: 14px; padding: .85rem 1.1rem; text-decoration: none; color: var(--text);
  transition: .15s;
}
.linkcard:hover { border-color: var(--blue); transform: translateX(4px); }
.linkcard b { color: var(--blue); }
.linkcard span { display: block; color: var(--muted); font-size: .87rem; margin-top: .15rem; }
.linkcard .tag {
  display: inline-block; font-size: .68rem; font-weight: 800; border-radius: 99px;
  padding: .02rem .5rem; margin-left: .4rem; vertical-align: middle; color: #0a1430;
}

/* Scroll-Reveal */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .6s, transform .6s; }
.reveal.vis { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
