:root{
  --bg:#f4f7fb;--card:#fff;--text:#1b2430;--muted:#667085;
  --primary:#315efb;--primary-soft:#edf2ff;
  --success:#16803b;--success-soft:#eaf8ef;
  --danger:#c9362b;--danger-soft:#fff0ee;
  --border:#dfe5ee;--shadow:0 18px 45px rgba(27,36,48,.12);
  --lc:#315efb;
}
*{box-sizing:border-box}
body{
  margin:0;min-height:100vh;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;
  background:
    radial-gradient(circle at top left,rgba(49,94,251,.12),transparent 30%),
    radial-gradient(circle at bottom right,rgba(22,128,59,.08),transparent 28%),
    var(--bg);
  color:var(--text)
}
.page{width:min(1040px,calc(100% - 32px));margin:0 auto;padding:36px 0 90px}

/* ── header ── */
header{margin-bottom:20px}
h1{margin:0 0 8px;font-size:clamp(1.8rem,5vw,3rem);line-height:1.05;letter-spacing:-.04em}
.subtitle{margin:0;color:var(--muted);font-size:1rem;line-height:1.65;max-width:720px}

/* ── sub-pages (profile, stats) ── */
.page-sub{padding-top:24px}
.sub-header{display:flex;align-items:center;gap:14px;margin-bottom:24px}
.sub-header h1{font-size:clamp(1.4rem,4vw,2.2rem);margin:0}
.back-link{
  display:inline-flex;align-items:center;gap:6px;
  color:var(--muted);text-decoration:none;font-weight:700;font-size:.9rem;
  padding:6px 12px;border-radius:10px;transition:background .15s,color .15s;
  white-space:nowrap
}
.back-link:hover{background:#eef1f6;color:var(--text)}
.muted{color:var(--muted)}

/* ── profile card ── */
.profile-card{
  background:var(--card);border:1px solid var(--border);border-radius:24px;
  box-shadow:var(--shadow);padding:28px 24px;margin-bottom:16px
}
.profile-card-top{display:flex;align-items:center;gap:20px;margin-bottom:22px}
.profile-avatar{width:72px;height:72px;border-radius:50%;flex-shrink:0;
  box-shadow:0 4px 14px rgba(49,94,251,.24)}
.profile-info{flex:1;min-width:0}
.profile-name{font-size:1.25rem;font-weight:900;margin:0 0 4px}
.profile-level{font-size:.88rem;font-weight:700;margin:0 0 8px}
.profile-rank{
  display:inline-block;padding:4px 12px;border-radius:999px;
  font-size:.78rem;font-weight:800;border:1.5px solid currentColor;
  background:rgba(0,0,0,.04)
}
.profile-xp-section{margin-bottom:20px}
.profile-xp-header{
  display:flex;justify-content:space-between;
  font-size:.82rem;margin-bottom:6px;font-weight:600
}
.profile-xp-wrap{height:8px;background:#e9edf5;border-radius:999px;overflow:hidden}
.profile-xp-bar{
  height:100%;border-radius:999px;
  background:linear-gradient(90deg,var(--lc,#315efb),color-mix(in srgb,var(--lc,#315efb) 60%,#7047eb));
  transition:width .5s ease
}
.profile-stats-grid{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px
}
.profile-stat{
  background:#f8faff;border:1px solid var(--border);border-radius:14px;
  padding:12px 10px;text-align:center
}
.profile-stat-val{display:block;font-size:1.35rem;font-weight:900;margin-bottom:2px}
.profile-stat-lbl{font-size:.7rem;color:var(--muted);font-weight:600}

/* ── action link card ── */
.action-link-card{
  display:block;padding:16px 20px;border-radius:18px;
  background:var(--card);border:1px solid var(--border);
  color:var(--primary);font-weight:700;text-decoration:none;
  transition:box-shadow .15s,background .15s;
  box-shadow:0 2px 8px rgba(27,36,48,.06)
}
.action-link-card:hover{box-shadow:var(--shadow);background:#fafbff}

/* ── stats page ── */
.stats-section{margin-bottom:24px}
.stats-section>h2{font-size:1.05rem;margin:0 0 12px;font-weight:800}
.stats-overview{
  background:var(--card);border:1px solid var(--border);border-radius:20px;
  padding:20px;box-shadow:0 2px 10px rgba(27,36,48,.07)
}
.stats-lv-row{display:flex;align-items:center;gap:10px;margin-bottom:6px}
.stats-lv-name{font-size:1rem;font-weight:800}
.stats-xp-wrap{flex:1;height:8px;background:#e9edf5;border-radius:999px;overflow:hidden}
.stats-xp-fill{
  height:100%;border-radius:999px;
  background:linear-gradient(90deg,var(--lc,#315efb),color-mix(in srgb,var(--lc,#315efb) 60%,#7047eb))
}
.stats-xp-lbl{font-size:.77rem;color:var(--muted);margin:4px 0 14px}
.stats-grid{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px
}
.stats-cell{
  background:#f8faff;border:1px solid var(--border);border-radius:12px;
  padding:10px;text-align:center
}
.stats-cell-val{display:block;font-size:1.15rem;font-weight:900;margin-bottom:2px}
.stats-cell-lbl{font-size:.68rem;color:var(--muted);font-weight:600}

/* ── skill cards ── */
.skill-card{
  background:var(--card);border:1px solid var(--border);border-radius:20px;
  padding:18px 20px;margin-bottom:12px;
  box-shadow:0 2px 10px rgba(27,36,48,.07)
}
.skill-card-header{
  display:flex;justify-content:space-between;align-items:baseline;margin-bottom:2px
}
.skill-card-header h3{margin:0;font-size:.95rem;font-weight:800}
.skill-level-badge{font-size:.85rem;font-weight:800}
.skill-level-name{margin:0 0 10px;font-size:.78rem;font-weight:600}
.skill-xp-wrap{height:7px;background:#e9edf5;border-radius:999px;overflow:hidden;margin-bottom:5px}
.skill-xp-fill{
  height:100%;border-radius:999px;
  background:linear-gradient(90deg,var(--lc,#315efb),color-mix(in srgb,var(--lc,#315efb) 60%,#7047eb))
}
.skill-xp-lbl{font-size:.72rem;color:var(--muted);margin:0 0 12px}
.skill-stats-row{display:flex;gap:7px;flex-wrap:wrap}
.skill-stat-chip{
  padding:4px 10px;border-radius:8px;font-size:.76rem;font-weight:700;
  background:#f8faff;border:1px solid var(--border)
}
.skill-stat-chip.correct{
  background:var(--success-soft);color:var(--success);border-color:#bfe6ca
}
.skill-stat-chip.wrong{
  background:var(--danger-soft);color:var(--danger);border-color:#f0c1bc
}
.skill-stat-chip.quota{
  background:var(--primary-soft);color:var(--primary);border-color:#c7d7ff
}

/* ── bottom nav ── */
.bottom-nav{
  position:fixed;bottom:0;left:0;right:0;z-index:200;
  background:rgba(255,255,255,.97);backdrop-filter:blur(16px);
  border-top:1.5px solid var(--border);
  box-shadow:0 -4px 28px rgba(27,36,48,.11)
}
.bn-panel{
  overflow:hidden;max-height:0;
  transition:max-height .35s cubic-bezier(.4,0,.2,1);
  border-bottom:1px solid var(--border)
}
.bottom-nav.open-games .bn-panel-games{max-height:200px}
.bottom-nav.open-profile .bn-panel-profile{max-height:80px}
.bn-panel-inner{
  padding:10px 16px;display:flex;align-items:center;gap:14px
}
.bn-panel-label{
  font-size:.72rem;color:var(--muted);font-weight:700;white-space:nowrap;margin:0
}
/* profile expand panel */
.bn-xp-info{flex:1;min-width:0}
.bn-xp-wrap{height:5px;background:#e9edf5;border-radius:999px;overflow:hidden;margin-bottom:5px}
.bn-xp-fill{
  height:100%;border-radius:999px;
  background:linear-gradient(90deg,#315efb,#7047eb);
  transition:width .4s ease
}
.bn-xp-text{margin:0;font-size:.72rem;color:var(--muted);font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bn-profile-link{
  flex-shrink:0;padding:6px 14px;border-radius:10px;
  background:var(--primary);color:white;
  font-size:.78rem;font-weight:700;text-decoration:none
}
.bn-avatar-mini{width:22px;height:22px;border-radius:50%;flex-shrink:0}
.bn-subjects{display:flex;gap:8px;flex:1;flex-wrap:wrap}
.bn-subject{
  flex:1;padding:7px 14px;border:2px solid var(--border);border-radius:12px;
  background:white;font:inherit;font-weight:700;cursor:pointer;
  transition:all .18s ease;color:var(--muted);font-size:.82rem
}
.bn-subject.active{
  border-color:var(--success);background:var(--success-soft);color:var(--success)
}
.bn-subject:hover:not(.active){border-color:#86efac;background:#f0fdf4}
.bn-bar{
  display:flex;align-items:center;gap:2px;
  padding:6px 10px;min-height:52px
}
.bn-btn{
  display:flex;flex-direction:column;align-items:center;gap:2px;
  padding:5px 9px;border-radius:10px;border:none;background:none;
  cursor:pointer;color:var(--muted);font:inherit;
  text-decoration:none;transition:background .15s,color .15s;flex-shrink:0
}
.bn-btn:hover{background:#eef1f6;color:var(--text)}
.bn-btn.active-nav{color:var(--primary)}
.bn-icon-svg{width:20px;height:20px;flex-shrink:0}
.bn-label{font-size:.62rem;font-weight:700;white-space:nowrap;line-height:1.2}
.bn-chevron{font-size:.8em;display:inline-block;transition:transform .3s ease}
.bottom-nav.open-games .bn-chevron{transform:rotate(180deg)}
.bn-spacer{flex:1}

/* ── Erweitert toggle (on-page) ── */
.ext-toggle{
  display:inline-flex;align-items:center;gap:5px;flex-shrink:0;
  padding:6px 13px;border-radius:999px;border:1.5px solid var(--border);
  background:white;cursor:pointer;font:inherit;font-size:.8rem;font-weight:700;
  color:var(--muted);transition:all .18s ease
}
.ext-toggle[aria-pressed="true"]{
  background:var(--primary-soft);color:var(--primary);border-color:#9bb0ff
}

/* ── session stats ── */
.stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:16px}
.stat{background:rgba(255,255,255,.8);border:1px solid var(--border);border-radius:16px;
  padding:13px 16px;backdrop-filter:blur(8px)}
.stat-label{display:block;color:var(--muted);font-size:.82rem;margin-bottom:3px}
.stat-value{font-size:1.3rem;font-weight:800}

/* ── quiz card ── */
.card{background:var(--card);border:1px solid var(--border);border-radius:24px;
  box-shadow:var(--shadow);overflow:hidden}
.card-top{padding:20px 24px 14px;border-bottom:1px solid var(--border);
  display:flex;align-items:center;justify-content:space-between;gap:16px}
.badge{display:inline-flex;align-items:center;gap:8px;padding:7px 13px;
  border-radius:999px;background:var(--primary-soft);color:var(--primary);
  font-size:.85rem;font-weight:750}
.progress-wrap{flex:1;max-width:320px;height:8px;background:#e9edf5;
  border-radius:999px;overflow:hidden}
.progress{height:100%;width:0;background:linear-gradient(90deg,#315efb,#7047eb);
  transition:width .3s ease}
.content{padding:26px 24px 22px}
.prompt{font-size:1rem;color:var(--muted);margin-bottom:14px}
@keyframes revealIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
.formula-box{
  min-height:175px;display:grid;place-items:center;text-align:center;
  background:linear-gradient(180deg,#fbfcff,#f6f8fc);
  border:1px solid var(--border);border-radius:18px;
  padding:22px;margin-bottom:20px;overflow-x:auto
}
.formula-box.revealed,.answers.revealed{animation:revealIn .2s ease both}
.formula-box mjx-container{font-size:130%!important;margin:0!important}
.answers{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.answer{
  appearance:none;border:1.5px solid var(--border);background:white;
  border-radius:16px;padding:14px 16px;text-align:left;cursor:pointer;
  transition:transform .15s ease,border-color .15s ease,background .15s ease;
  color:var(--text);font:inherit;font-weight:720;line-height:1.35
}
.answer:hover{transform:translateY(-2px);border-color:#9bb0ff;background:#fafbff}
.answer.correct{border-color:var(--success);background:var(--success-soft);color:var(--success)}
.answer.wrong{border-color:var(--danger);background:var(--danger-soft);color:var(--danger)}
.answer:disabled{cursor:default;transform:none}
.feedback{display:none;margin-top:16px;border-radius:16px;padding:15px 18px;line-height:1.55}
.feedback.show{display:block}
.feedback.good{background:var(--success-soft);color:#135d2d;border:1px solid #bfe6ca}
.feedback.bad{background:var(--danger-soft);color:#84251e;border:1px solid #f0c1bc}
.actions{display:flex;justify-content:space-between;gap:12px;margin-top:18px}
button.primary,button.secondary{
  border:0;border-radius:14px;padding:12px 18px;font:inherit;font-weight:780;cursor:pointer
}
button.primary{background:var(--primary);color:white;box-shadow:0 8px 18px rgba(49,94,251,.24)}
button.primary:disabled{opacity:.45;cursor:not-allowed;box-shadow:none}
button.secondary{background:#eef1f6;color:var(--text)}

/* ── cheatsheet ── */
.cheatsheet{margin-top:22px;padding:20px 24px;border:1px solid var(--border);
  border-radius:20px;background:rgba(255,255,255,.78)}
.cheatsheet h2{margin:0 0 12px;font-size:1.05rem}
.cheat-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.cheat{border:1px solid var(--border);background:white;border-radius:14px;padding:13px}
.cheat strong{display:block;margin-bottom:6px}
.cheat p{margin:0;color:var(--muted);line-height:1.5;font-size:.92rem}

/* ── xp toast ── */
.xp-toast{
  position:fixed;top:20px;right:20px;
  padding:10px 20px;border-radius:14px;font-weight:800;font-size:1.05rem;
  background:rgba(17,24,39,.92);backdrop-filter:blur(8px);color:white;
  opacity:0;transform:translateY(-10px) scale(.95);
  transition:all .25s cubic-bezier(.34,1.56,.64,1);
  pointer-events:none;z-index:9999
}
.xp-toast.show{opacity:1;transform:translateY(0) scale(1)}
.xp-toast.pos{color:#4ade80}
.xp-toast.neg{color:#f87171}
.xp-toast.lvlup{color:#ffd700;font-size:1.15rem}

/* ── Homogenisierung game ── */
.hom-answers{grid-template-columns:1fr}
.hom-answers .answer{text-align:left;min-height:54px}
.formula-box.hom-mode{place-items:start;min-height:auto}
.hom-q{width:100%;font-size:.93rem;line-height:1.5}
.hom-label{font-size:.74rem;font-weight:800;color:var(--primary);margin:10px 0 2px;
  text-transform:uppercase;letter-spacing:.05em}
.hom-label:first-child{margin-top:0}
.hom-sys{margin:0 0 4px;line-height:1.75;color:var(--text)}
.hom-info{font-size:.86rem;color:var(--muted);margin-top:10px;padding-top:10px;
  border-top:1px solid var(--border);line-height:1.9}

/* ── Kurvenintegrale (geschlossen & offen) ── */
.cnt-q{width:100%;font-size:.93rem;line-height:1.6}
.cnt-integral{text-align:center;font-size:1rem;margin:6px 0 4px}
.cnt-curve{font-size:.86rem;color:var(--muted);text-align:center;margin:2px 0 8px;
  padding:4px 12px;background:var(--border);border-radius:6px;display:block}
.cnt-hint{font-size:.81rem;color:var(--primary);margin-top:8px;padding:5px 10px;
  background:rgba(49,94,251,.08);border-radius:6px}

/* ── responsive ── */
@media(max-width:680px){
  .answers,.cheat-grid,.stats{grid-template-columns:1fr}
  .card-top{flex-wrap:wrap}
  .progress-wrap{width:100%;max-width:none;order:3}
  .content{padding:18px 14px}
  .formula-box{min-height:155px;padding:16px 10px}
  .formula-box mjx-container{font-size:110%!important}
  .bn-panel-inner{flex-direction:column;align-items:flex-start;gap:8px}
  .bn-subjects{width:100%}
  .profile-stats-grid,.stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}

  /* ── mobile nav improvements ── */
  .bn-bar{min-height:64px;padding:6px 12px}
  .bn-btn{padding:7px 14px;gap:4px}
  .bn-icon-svg{width:24px;height:24px}
  .bn-avatar-mini{width:26px;height:26px}
  .bn-label{font-size:.68rem}
  .bn-subject{padding:9px 12px;font-size:.84rem}
  .bottom-nav.open-games .bn-panel-games{max-height:280px}
  .bottom-nav.open-profile .bn-panel-profile{max-height:130px}
  .page{padding-bottom:100px}
}
