/* ============================================================
   style.css — „Logik-Werkstatt" (House-Style Hans Lietz).
   Helles, freundliches Theme; Klassen passend zur generischen App-Engine.
   Zero-Dependency, system-fonts, responsiv, WCAG-AA als Ziel.
   ============================================================ */
:root {
  --accent: #4f46e5;        /* Indigo */
  --accent-2: #0e9384;      /* Teal */
  --navy: #1d3557;
  --ink: #1f2433;
  --muted: #5b6577;
  --line: #d8dee9;
  --paper: #ffffff;
  --bg: #eef2fb;
  --soft: #f5f8fd;
  --r: 16px;
  --shadow: 0 8px 24px rgba(29, 53, 87, .12);
  --ok: #0e9384;
  --warn: #e9a800;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); line-height: 1.55;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 420px at 100% -60px, #dfe7ff 0, transparent 60%), var(--bg);
}

/* ---------- Kopf ---------- */
.top { background: linear-gradient(135deg, var(--navy), #34508a); 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); }
#module-sub { max-width: 980px; margin: .35rem auto 0; opacity: .92; font-size: .98rem; }
.top__nav { max-width: 980px; margin: .6rem auto 0; display: flex; gap: .6rem; }
.top__nav a { color: #cfe0ff; 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-Bar (Level/XP/Badges) ---------- */
.app-status { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; font-size: .82rem; }
.app-name { background: rgba(255,255,255,.16); padding: .2rem .55rem; border-radius: 999px; font-weight: 800; }
.app-level { background: var(--accent); padding: .2rem .6rem; border-radius: 999px; font-weight: 800; }
.app-xpbar { position: relative; width: 130px; height: 16px; background: rgba(255,255,255,.2); border-radius: 999px; overflow: hidden; }
.app-xpbar__fill { position: absolute; inset: 0; width: 0; background: linear-gradient(90deg, var(--accent-2), #6ee7d8); transition: width .5s; }
.app-xpbar__txt { position: relative; display: block; text-align: center; font-size: .68rem; line-height: 16px; font-weight: 800; color: #04231f; }
.app-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; min-height: 44px; }
.tierbtn.is-on { border-color: var(--accent); background: #ecebfd; color: #312e9c; }

/* ---------- 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, .station__basis li, .block p, .block li { margin: .45rem 0; }
.station__basis h4 { margin: .8rem 0 .2rem; color: var(--navy); }
.station__basis ul, .station__basis ol, .block ul, .block ol { padding-left: 1.2rem; }
blockquote { margin: .6rem 0; padding: .6rem .9rem; background: var(--soft); border-left: 4px solid var(--accent); border-radius: 0 10px 10px 0; }
blockquote p { margin: 0; }
.station__basis table, .block table { border-collapse: collapse; width: 100%; margin: .6rem 0; font-size: .9rem; }
.station__basis th, .station__basis td, .block th, .block td { border: 1px solid var(--line); padding: .4rem .55rem; text-align: left; }
.station__basis th, .block th { background: var(--soft); }
.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: #e7f6ec; color: #0f5132; }
.badge.todo { background: #f0f3f9; color: var(--muted); }
.station__status { margin-top: .7rem; }

/* ---------- Lab ---------- */
.lab { margin-top: .9rem; }
.lab__todo { background: #fff3f3; border: 1px dashed #f0b3b3; border-radius: 12px; padding: .8rem; color: #9b2c2c; font-weight: 600; }
button.primary { appearance: none; border: none; cursor: pointer; font-weight: 800; font-size: 1rem; color: #fff; background: var(--accent); padding: .65rem 1.1rem; border-radius: 12px; box-shadow: 0 4px 0 #3730a3; transition: transform .08s, filter .15s; min-height: 44px; }
button.primary:hover { filter: brightness(1.06); }
button.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #3730a3; }
button.primary:disabled { opacity: .5; cursor: default; box-shadow: none; transform: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- 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); }
.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-opt { color: var(--muted); font-weight: 600; font-size: .85em; }
.auth-card input { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: .6rem; font: inherit; }
.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 #3730a3; min-height: 44px; }
.auth-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #3730a3; }
.auth-guest { width: 100%; margin-top: .6rem; background: #fff; border: 1.5px solid var(--line); color: var(--navy); font-weight: 800; font-size: 1rem; padding: .7rem; border-radius: 12px; cursor: pointer; min-height: 44px; }
.auth-guest:hover { background: var(--soft); }
.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); color: #fff; 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; }

@media (max-width: 640px) {
  .top__row { flex-direction: column; align-items: flex-start; }
  .app-status { font-size: .76rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
