/* ============================================================
   style.css — „Die Trolley-Maschine" (House-Style Hans Lietz).
   Fröhlich-comichaftes, helles Theme; gleiche Klassen-Konventionen
   wie philosophie-dilemma/astronomie (Station/Tier/Lab/Badge).
   Zero-Dependency, system-fonts, responsiv.
   ============================================================ */
:root {
  --accent: #e63946;
  --accent-2: #2a9d8f;
  --navy: #1d3557;
  --ink: #21263a;
  --muted: #5b6577;
  --line: #d8dee9;
  --paper: #ffffff;
  --bg: #eef3fb;
  --soft: #f5f8fd;
  --r: 16px;
  --shadow: 0 8px 24px rgba(29, 53, 87, .12);
  --ok: #2a9d8f;
  --warn: #e9a800;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 100% -50px, #d8ecff 0, transparent 60%),
    var(--bg);
  line-height: 1.55;
}

/* ---------- Kopf ---------- */
.top {
  background: linear-gradient(135deg, var(--navy), #2a4a73);
  color: #fff;
  padding: 1rem 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
.top__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; max-width: 980px; margin: 0 auto; }
.top h1 { margin: 0; font-size: clamp(1.35rem, 3.5vw, 2rem); letter-spacing: .2px; }
.top #module-sub { margin: .35rem auto 0; max-width: 980px; opacity: .92; font-size: .98rem; }
.top__nav { max-width: 980px; margin: .6rem auto 0; display: flex; gap: .6rem; }
.top__nav a { color: #cfe3ff; text-decoration: none; font-weight: 700; font-size: .85rem; background: rgba(255,255,255,.12); padding: .25rem .65rem; border-radius: 999px; }
.top__nav a:hover { background: rgba(255,255,255,.24); }

/* Status-Leiste (Level/XP/Badges) */
.tr-status { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; font-size: .82rem; }
.tr-name { background: rgba(255,255,255,.16); padding: .2rem .55rem; border-radius: 999px; font-weight: 800; }
.tr-level { background: var(--accent); padding: .2rem .6rem; border-radius: 999px; font-weight: 800; }
.tr-xpbar { position: relative; width: 130px; height: 16px; background: rgba(255,255,255,.2); border-radius: 999px; overflow: hidden; }
.tr-xpbar__fill { position: absolute; inset: 0; width: 0; background: linear-gradient(90deg, var(--accent-2), #8ce0d0); transition: width .5s; }
.tr-xpbar__txt { position: relative; display: block; text-align: center; font-size: .68rem; line-height: 16px; font-weight: 800; color: #06251f; }
.tr-badges { background: rgba(255,255,255,.16); padding: .2rem .55rem; border-radius: 999px; font-weight: 800; }

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

/* ---------- Differenzierungsleiste ---------- */
#diff-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .4rem 0 1rem; }
#progress { color: var(--muted); font-weight: 700; font-size: .88rem; }
.tierbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.tierbar__lbl { color: var(--muted); font-weight: 800; font-size: .82rem; }
.tierbtn { border: 1.5px solid var(--line); background: var(--paper); color: var(--muted); padding: .3rem .7rem; border-radius: 999px; font-weight: 800; font-size: .82rem; cursor: pointer; }
.tierbtn.is-on { border-color: var(--accent-2); background: #e7f7f3; color: #14655a; }

/* ---------- Stationen ---------- */
.station {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
  margin: 0 0 1.1rem;
}
.station__head { display: flex; flex-direction: column; gap: .15rem; margin-bottom: .5rem; }
.station__no { color: var(--muted); font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.station__title { margin: 0; color: var(--navy); font-size: clamp(1.1rem, 2.5vw, 1.4rem); }
.station__basis p, .block p { margin: .5rem 0; }
.station__aufgabe { margin-top: .9rem; background: #fff6e6; border: 1px solid #ffe1ad; border-radius: 12px; padding: .7rem .85rem; font-size: .95rem; }

.block { margin: .7rem 0; border: 1px solid var(--line); border-radius: 12px; padding: .2rem .85rem; background: var(--soft); }
.block summary { cursor: pointer; font-weight: 800; color: var(--navy); padding: .55rem 0; }
.tier-mehr { border-left: 4px solid #6aa9ff; }
.tier-forscher { border-left: 4px solid #b07cf0; }

.badge { display: inline-block; border-radius: 999px; padding: .25rem .6rem; font-weight: 800; font-size: .8rem; }
.badge.ok { background: #e7f7f3; color: #14655a; }
.badge.todo { background: #f0f3f9; color: var(--muted); }
.station__status { margin-top: .7rem; }

.lab { margin-top: .9rem; }
.lab__todo { background: #fff3f3; border: 1px dashed #f0b3b3; border-radius: 12px; padding: .8rem; color: #9b2c2c; font-weight: 600; }

/* ---------- Buttons ---------- */
.tr-btn {
  appearance: none; border: none; cursor: pointer;
  font-weight: 800; font-size: 1rem; color: #fff;
  padding: .7rem 1.1rem; border-radius: 12px;
  box-shadow: 0 4px 0 rgba(0,0,0,.18); transition: transform .08s, filter .15s;
}
.tr-btn:hover { filter: brightness(1.05); }
.tr-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.tr-btn:disabled { opacity: .55; cursor: default; box-shadow: none; transform: none; }
.tr-btn.act { background: var(--accent); }
.tr-btn.idle { background: #6b7280; }
.tr-btn.kant { background: #b07cf0; }
.tr-btn.mill { background: var(--accent-2); }
.tr-btn.next { background: var(--navy); margin-top: .9rem; }

/* ---------- Trolley-Lab ---------- */
.trolley-lab { border: 2px solid var(--line); border-radius: 14px; padding: .9rem; background: var(--soft); }
.tr-top { display: flex; justify-content: space-between; align-items: center; }
.tr-counter { font-weight: 800; color: var(--muted); font-size: .85rem; }
.tr-mute { border: none; background: #fff; border-radius: 10px; padding: .25rem .5rem; cursor: pointer; font-size: 1rem; box-shadow: var(--shadow); }
.tr-title { margin: .4rem 0 .6rem; color: var(--navy); }
.tr-stage { border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); background: #e9f7ff; }
.trolley-scene { display: block; width: 100%; height: auto; }
.fig-svg { overflow: visible; }
.tr-text { margin: .8rem 0; font-size: 1.02rem; }
.tr-actions { display: flex; gap: .7rem; flex-wrap: wrap; }
.tr-hint { color: var(--muted); font-size: .85rem; margin: .7rem 0 0; }

.tr-reveal { margin-top: 1rem; border-top: 2px dashed var(--line); padding-top: 1rem; animation: fade .4s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tr-yourchoice { font-size: 1.05rem; }
.tr-vote { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .8rem; margin: .6rem 0; }
.tr-vote-lbl { margin: 0 0 .5rem; font-weight: 800; color: var(--navy); font-size: .92rem; }
.tr-bar { display: flex; height: 30px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.tr-bar-a, .tr-bar-u { display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; color: #06251f; min-width: 0; overflow: hidden; white-space: nowrap; transition: width .6s; }
.tr-bar-a { background: #ffb3ba; }
.tr-bar-u { background: #bfe3ff; }
.tr-vote-n { margin: .4rem 0 0; color: var(--muted); font-size: .8rem; }
.tr-witz { background: #fff6e6; border-radius: 10px; padding: .6rem .8rem; font-style: italic; }

.tr-theorien { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: .8rem 0; }
.tr-card { border-radius: 12px; padding: .8rem .9rem; border: 1px solid var(--line); }
.tr-card h4 { margin: 0 0 .4rem; }
.tr-card.kant { background: #f3ecfd; border-color: #ddc7fb; }
.tr-card.mill { background: #e7f7f3; border-color: #b6e6dc; }
.tr-card p { margin: 0; font-size: .92rem; }

.tr-reason-lbl { display: block; font-weight: 800; color: var(--navy); margin-top: .6rem; }
.tr-reason-lbl textarea { display: block; width: 100%; margin-top: .35rem; border: 1.5px solid var(--line); border-radius: 10px; padding: .55rem; font: inherit; resize: vertical; }

.tr-done { text-align: center; padding: 1rem; }
.tr-done h3 { color: var(--navy); }

/* ---------- Zuordnungs-Lab ---------- */
.zu-lab { border: 2px solid var(--line); border-radius: 14px; padding: 1rem; background: var(--soft); }
.zu-counter { font-weight: 800; color: var(--muted); font-size: .85rem; margin: 0 0 .5rem; }
.zu-quote { margin: 0 0 .9rem; border-left: 4px solid var(--accent); background: #fff; padding: .8rem 1rem; border-radius: 0 10px 10px 0; font-size: 1.05rem; }
.zu-actions { display: flex; gap: .7rem; flex-wrap: wrap; }
.zu-fb { margin-top: .8rem; }
.zu-ok { color: #14655a; font-weight: 800; }
.zu-no { color: #9b2c2c; font-weight: 800; }

/* ---------- Profil-Lab ---------- */
.profil-lab { }
.pr-empty { background: var(--soft); border: 1px dashed var(--line); border-radius: 12px; padding: 1rem; }
.pr-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem; box-shadow: var(--shadow); }
.pr-card h3 { margin: 0 0 .5rem; color: var(--navy); }
.pr-meters { display: grid; gap: .9rem; margin: 1rem 0; }
.pr-meter-lbl { font-weight: 800; color: var(--navy); font-size: .92rem; }
.pr-track { height: 18px; background: #eef1f7; border-radius: 999px; overflow: hidden; margin: .3rem 0; }
.pr-fill { height: 100%; border-radius: 999px; transition: width .7s; }
.pr-fill.mill { background: linear-gradient(90deg, var(--accent-2), #8ce0d0); }
.pr-fill.kant { background: linear-gradient(90deg, #b07cf0, #d8bdfb); }
.pr-meter-val { color: var(--muted); font-size: .82rem; font-weight: 700; }
.pr-means { background: #f3ecfd; border-radius: 10px; padding: .65rem .8rem; }
.pr-note { background: #fff6e6; border-radius: 10px; padding: .65rem .8rem; font-size: .9rem; }

/* ---------- Auth-Overlay ---------- */
.auth-overlay { position: fixed; inset: 0; background: rgba(15, 26, 54, .72); display: none; align-items: center; justify-content: center; padding: 1rem; z-index: 1000; }
.auth-overlay.open { display: flex; }
.auth-card { background: #fff; border-radius: 18px; padding: 1.4rem; max-width: 440px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.4); animation: fade .3s ease; }
.auth-card h2 { margin: 0 0 .5rem; color: var(--navy); }
.auth-note { color: var(--ink); font-size: .95rem; }
.auth-card label { display: block; font-weight: 800; color: var(--navy); margin: .7rem 0 .2rem; font-size: .9rem; }
.auth-card input { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: .6rem; font: inherit; }
.auth-card code { background: #f0f3f9; padding: .1rem .35rem; border-radius: 6px; }
.auth-err { color: #c0392b; font-weight: 700; min-height: 1.2rem; margin: .4rem 0 0; }
.auth-btn { width: 100%; margin-top: .8rem; border: none; background: var(--accent); color: #fff; font-weight: 800; font-size: 1.05rem; padding: .75rem; border-radius: 12px; cursor: pointer; box-shadow: 0 4px 0 #a52834; }
.auth-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #a52834; }
.auth-hint { color: var(--muted); font-size: .8rem; margin-top: .7rem; }

/* ---------- Toasts ---------- */
.badge-toast { position: fixed; right: 16px; bottom: 16px; background: #fff; border: 2px solid var(--accent-2); border-radius: 14px; padding: .7rem .9rem; display: flex; gap: .6rem; align-items: center; box-shadow: var(--shadow); transform: translateY(20px); opacity: 0; transition: .35s; z-index: 1100; max-width: 300px; }
.badge-toast.show { transform: none; opacity: 1; }
.badge-toast__icon { font-size: 1.8rem; }
.xp-toast { position: fixed; left: 50%; top: 76px; transform: translate(-50%, -10px); background: var(--accent-2); color: #06251f; font-weight: 900; padding: .4rem .9rem; border-radius: 999px; opacity: 0; transition: .35s; z-index: 1100; }
.xp-toast.show { transform: translate(-50%, 0); opacity: 1; }

.sync-badge { position: fixed; left: 12px; bottom: 12px; background: var(--navy); color: #fff; font-size: .78rem; font-weight: 700; padding: .3rem .7rem; border-radius: 999px; opacity: 0; transition: .3s; z-index: 1100; }
.sync-badge.show { opacity: 1; }

/* ---------- Fuß ---------- */
.foot { max-width: 980px; margin: 0 auto; padding: 1.4rem 1.1rem 2rem; color: var(--muted); font-size: .85rem; }
.muted { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .tr-theorien { grid-template-columns: 1fr; }
  .top__row { flex-direction: column; align-items: flex-start; }
  .tr-status { font-size: .76rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
