:root {
  --bg: #131f24;
  --bg-2: #1a2a31;
  --card: #202f36;
  --border: #37464f;
  --text: #f1f7fb;
  --muted: #8a9ba3;
  --faint: #52656d;
  --green: #58cc02; --green-d: #58a700; --green-bg: #203b16;
  --blue: #1cb0f6; --blue-d: #1899d6; --blue-bg: #19344a;
  --red: #ff4b4b; --red-d: #ea2b2b; --red-bg: #3f2226;
  --yellow: #ffc800; --yellow-d: #e5a400;
  --orange: #ff9600; --orange-d: #e57d00;
  --purple: #ce82ff; --purple-d: #a560d8;
  --teal: #00cd9c;
  --font: 'Nunito', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-weight: 700; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
button { font-family: inherit; }
a { color: var(--blue); text-decoration: none; }
input, select { font-family: inherit; }
::selection { background: var(--blue); color: #fff; }
.hidden { display: none !important; }

/* ───────── Buttons ───────── */
.btn {
  --c: var(--green); --cd: var(--green-d); --fg: #131f24;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border: 0; border-radius: 16px;
  background: var(--c); color: var(--fg); box-shadow: 0 4px 0 var(--cd);
  font-size: 15px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
  cursor: pointer; transition: filter .1s, transform .05s; user-select: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(4px); box-shadow: none; }
.btn:disabled, .btn.disabled { --c: #37464f; --cd: #37464f; --fg: #52656d; cursor: default; filter: none; transform: none; box-shadow: 0 4px 0 var(--cd); }
.btn.blue { --c: var(--blue); --cd: var(--blue-d); }
.btn.red { --c: var(--red); --cd: var(--red-d); --fg: #fff; }
.btn.white { --c: #fff; --cd: #d0dbe0; --fg: var(--x, #58cc02); }
.btn.ghost { --c: transparent; --cd: var(--border); --fg: var(--blue); border: 2px solid var(--border); box-shadow: 0 4px 0 var(--border); }
.btn.ghost.muted { --fg: var(--muted); }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 13px; border-radius: 12px; }
.link-btn { background: none; border: 0; color: var(--blue); font-weight: 800; letter-spacing: .6px; text-transform: uppercase; font-size: 14px; cursor: pointer; padding: 6px; }

/* ───────── App-Layout ───────── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 256px; padding: 24px 16px;
  border-right: 2px solid var(--border); background: var(--bg); z-index: 20;
  display: flex; flex-direction: column; gap: 4px;
}
.logo { display: flex; align-items: center; gap: 8px; padding: 8px 16px 28px; font-size: 30px; font-weight: 900; color: var(--purple); letter-spacing: -1px; cursor: pointer; }
.logo svg { width: 38px; height: 38px; }
.nav-item {
  display: flex; align-items: center; gap: 20px; padding: 10px 16px; border-radius: 12px; border: 2px solid transparent;
  color: var(--muted); font-size: 15px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; cursor: pointer; text-align: left; background: none;
}
.nav-item svg { width: 32px; height: 32px; flex: none; }
.nav-item:hover { background: var(--bg-2); }
.nav-item.active { background: var(--blue-bg); border-color: #3f85a7; color: var(--blue); }
.main { flex: 1; margin-left: 256px; display: flex; justify-content: center; gap: 48px; padding: 24px 24px 64px; }
.center { width: 100%; max-width: 600px; }
.side-col { width: 368px; flex: none; position: sticky; top: 24px; align-self: flex-start; display: flex; flex-direction: column; gap: 22px; }
.mobile-top, .bottom-nav { display: none; }

/* Statusleiste */
.stats-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.stat { position: relative; display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; padding: 8px 10px; border-radius: 12px; cursor: pointer; background: none; border: 0; color: var(--text); }
.stat:hover { background: var(--bg-2); }
.stat svg { width: 28px; height: 28px; }
.stat.streak { color: var(--orange); } .stat.streak.off { color: var(--faint); }
.stat.gems { color: var(--blue); } .stat.hearts { color: var(--red); }
.course-badge { width: 34px; height: 28px; border-radius: 8px; border: 2px solid var(--border); display: grid; place-items: center; background: #2b1d0a; }
.course-badge svg { width: 22px; height: 22px; }

.panel { border: 2px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.panel h3 { margin: 0; font-size: 20px; font-weight: 800; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel .row { display: flex; gap: 16px; align-items: center; }
.panel p { margin: 4px 0; color: var(--muted); font-weight: 700; line-height: 1.45; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; color: var(--faint); font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; }

.progress { position: relative; height: 16px; border-radius: 99px; background: var(--border); overflow: hidden; }
.progress > i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--c, var(--yellow)); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.progress > i::after { content: ''; position: absolute; left: 8px; right: 8px; top: 4px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.3); }
.progress > span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: rgba(0,0,0,.45); }

.mission-mini { display: flex; gap: 14px; align-items: center; padding: 8px 0; }
.mission-mini + .mission-mini { border-top: 2px solid var(--border); padding-top: 16px; margin-top: 8px; }
.mission-mini .ic { width: 44px; height: 44px; flex: none; }
.mission-mini .body { flex: 1; }
.mission-mini .t { font-size: 16px; font-weight: 800; margin-bottom: 8px; }

/* ───────── Lernpfad ───────── */
.unit { margin-bottom: 40px; }
.unit-banner {
  position: sticky; top: 16px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px 16px 16px 18px; border-radius: 14px; background: var(--uc); box-shadow: 0 4px 0 var(--ucd); color: #fff;
}
.unit-banner .kicker { font-size: 13px; font-weight: 800; letter-spacing: .6px; opacity: .8; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.unit-banner h2 { margin: 4px 0 0; font-size: 21px; font-weight: 800; }
.guide-btn { display: flex; align-items: center; gap: 10px; flex: none; padding: 12px 16px; border-radius: 14px; border: 2px solid rgba(0,0,0,.2); background: transparent; box-shadow: 0 3px 0 rgba(0,0,0,.2); color: #fff; font-size: 14px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; cursor: pointer; }
.guide-btn:hover { background: rgba(255,255,255,.1); }
.guide-btn svg { width: 22px; height: 22px; }
.unit-divider { display: flex; align-items: center; gap: 16px; margin: 36px 0 12px; color: var(--faint); font-size: 17px; font-weight: 800; }
.unit-divider::before, .unit-divider::after { content: ''; flex: 1; height: 2px; background: var(--border); }
.path { position: relative; display: flex; flex-direction: column; align-items: center; padding: 30px 0 10px; }
.node-wrap { position: relative; margin: 10px 0; z-index: 1; transform: translateX(var(--x, 0)); }
.node-wrap.open { z-index: 40; }
.node-wrap.current { margin-top: 48px; }
.node {
  --c: var(--uc); --cd: var(--ucd);
  position: relative; width: 70px; height: 64px; border: 0; border-radius: 50%; background: var(--c);
  box-shadow: 0 8px 0 var(--cd); cursor: pointer; display: grid; place-items: center; color: #fff; transition: transform .1s;
}
.node svg { width: 34px; height: 34px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.15)); }
.node:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--cd); }
.node.locked { --c: #37464f; --cd: #2a383f; color: #52656d; }
.node.locked svg { filter: none; }
.node.chest, .node.chest.locked { background: none; box-shadow: none; width: 84px; height: 76px; }
.node.chest svg { width: 84px; height: 76px; filter: none; }
.node.chest.locked { opacity: .55; }
.node-ring { position: absolute; left: 50%; top: 50%; width: 100px; height: 100px; transform: translate(-50%, -46%); border-radius: 50%; pointer-events: none; }
.start-bubble {
  position: absolute; left: 50%; bottom: calc(100% + 14px); transform: translateX(-50%);
  padding: 10px 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--bg); color: var(--uc);
  font-size: 15px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; white-space: nowrap; animation: bob 1.2s ease-in-out infinite; z-index: 2;
}
.start-bubble::after { content: ''; position: absolute; left: 50%; top: 100%; width: 12px; height: 12px; background: var(--bg); border: 2px solid var(--border); border-top: 0; border-left: 0; transform: translate(-50%, -5px) rotate(45deg); }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -6px); } }
.popover {
  position: absolute; left: 50%; top: calc(100% + 18px); transform: translateX(-50%); width: 300px; z-index: 30;
  padding: 18px; border-radius: 16px; background: var(--uc); color: #fff; animation: pop .15s ease-out;
}
.popover::before { content: ''; position: absolute; left: 50%; top: -8px; width: 16px; height: 16px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 3px; }
.popover.locked { background: var(--bg); border: 2px solid var(--border); color: var(--muted); }
.popover.locked::before { border: 2px solid var(--border); border-right: 0; border-bottom: 0; top: -10px; }
.popover h4 { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.popover p { margin: 0 0 16px; font-size: 15px; opacity: .9; }
.popover .btn.white { --x: var(--uc); width: 100%; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -12px) scale(.8); } }
.popover { transform-origin: 50% 0; animation: pop .32s cubic-bezier(.34,1.56,.64,1); }
.mascot-side { position: absolute; top: 120px; width: 150px; pointer-events: none; }
.mascot-side.left { left: 30px; } .mascot-side.right { right: 30px; }
.path-end { text-align: center; padding: 40px 20px; color: var(--muted); }
.path-end svg { width: 110px; height: 110px; }
.path-end h3 { color: var(--text); font-size: 22px; margin: 10px 0 6px; }

/* ───────── Modal ───────── */
.modal-bg { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.6); animation: fade .15s; }
.modal { width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; border-radius: 20px; background: var(--bg); border: 2px solid var(--border); padding: 28px; text-align: center; }
.modal h2 { margin: 12px 0 8px; font-size: 24px; font-weight: 800; }
.modal p { color: var(--muted); margin: 0 0 22px; line-height: 1.5; }
.modal .actions { display: flex; flex-direction: column; gap: 14px; }
.modal.wide { max-width: 760px; text-align: left; }
.modal .close-x { float: right; background: none; border: 0; color: var(--faint); cursor: pointer; padding: 4px; }
.modal .close-x svg { width: 26px; height: 26px; }
@keyframes fade { from { opacity: 0; } }

/* Guidebook */
.guide h2 { font-size: 20px; margin: 26px 0 10px; color: var(--uc, var(--text)); }
.guide h2:first-child { margin-top: 4px; }
.guide p, .guide li { color: #d5e2e8; line-height: 1.6; font-weight: 600; }
.guide ul { padding-left: 22px; }

/* ───────── Code ───────── */
.code {
  margin: 0; padding: 16px 18px; border-radius: 14px; border: 2px solid var(--border); background: #0d171b;
  font-family: var(--mono); font-size: 14.5px; line-height: 1.65; font-weight: 500; color: #d7e3e8; overflow-x: auto; white-space: pre; text-align: left; tab-size: 4;
}
.md code, .inline-code, .opt code { font-family: var(--mono); font-size: .9em; font-weight: 600; padding: 2px 6px; border-radius: 6px; background: #0d171b; border: 1px solid var(--border); color: #7ee0ff; white-space: pre-wrap; }
.tk-kw { color: #ff7ab2; } .tk-type { color: #7ee0ff; } .tk-fn { color: #ffd166; } .tk-str { color: #a5e075; } .tk-num { color: #ce82ff; }
.tk-com { color: #6a7f88; font-style: italic; } .tk-ann { color: #ff9600; } .tk-const { color: #ce82ff; } .tk-key { color: #7ee0ff; } .tk-bool { color: #ff9600; }
.md p { margin: 0 0 12px; line-height: 1.6; }
.md p:last-child { margin-bottom: 0; }
.md strong { color: #fff; font-weight: 900; }

/* ───────── Lektion ───────── */
.lesson { min-height: 100vh; display: flex; flex-direction: column; }
.lesson-top { display: flex; align-items: center; gap: 20px; width: 100%; max-width: 1040px; margin: 0 auto; padding: 40px 24px 0; }
.icon-btn { background: none; border: 0; color: var(--faint); cursor: pointer; padding: 4px; display: grid; place-items: center; }
.icon-btn:hover { color: var(--muted); }
.icon-btn svg { width: 26px; height: 26px; }
.lesson-top .progress { flex: 1; }
.lesson-top .progress > i { --c: var(--green); }
.hearts-pill { display: flex; align-items: center; gap: 8px; color: var(--red); font-weight: 800; font-size: 18px; }
.hearts-pill svg { width: 30px; height: 30px; }
.hearts-pill.shake { animation: shake .4s; }
.combo { color: var(--orange); font-size: 14px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; margin: 0 auto; max-width: 600px; width: 100%; padding: 0 24px; height: 18px; margin-top: 14px; }
.lesson-body { flex: 1; display: flex; justify-content: center; padding: 30px 24px 180px; }
.challenge { width: 100%; max-width: 640px; animation: slidein .25s ease-out; }
@keyframes slidein { from { opacity: 0; transform: translateX(24px); } }
.challenge h1 { font-size: 30px; font-weight: 800; margin: 0 0 24px; line-height: 1.25; }
.challenge .kicker { display: flex; align-items: center; gap: 8px; color: var(--purple); font-size: 15px; font-weight: 900; letter-spacing: .8px; text-transform: uppercase; margin-bottom: 10px; }
.challenge .kicker svg { width: 22px; height: 22px; }
.challenge .code { margin-bottom: 24px; }
.speech { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 26px; }
.speech .mascot { width: 110px; flex: none; }
.bubble { position: relative; padding: 14px 18px; border: 2px solid var(--border); border-radius: 16px; font-size: 17px; line-height: 1.45; }
.bubble::before { content: ''; position: absolute; left: -9px; bottom: 22px; width: 14px; height: 14px; background: var(--bg); border-left: 2px solid var(--border); border-bottom: 2px solid var(--border); transform: rotate(45deg); }

.learn-card { border: 2px solid var(--border); border-radius: 20px; padding: 24px; background: var(--bg-2); }
.learn-card .md { font-size: 17px; color: #d5e2e8; font-weight: 600; margin-bottom: 18px; }
.learn-card .code { margin: 0; }

.options { display: grid; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 16px; width: 100%; min-height: 60px; padding: 12px 16px; text-align: left;
  border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 14px; background: none; color: var(--text); font-size: 17px; font-weight: 700; cursor: pointer;
}
.opt:hover { background: var(--bg-2); }
.opt .key { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--border); display: grid; place-items: center; font-size: 13px; color: var(--faint); }
.opt.sel { border-color: #3f85a7; background: var(--blue-bg); color: var(--blue); }
.opt.sel .key { border-color: #3f85a7; color: var(--blue); }
.opt.right { border-color: var(--green-d); background: var(--green-bg); color: var(--green); }
.opt.wrong { border-color: var(--red-d); background: var(--red-bg); color: var(--red); }
.opt:disabled { cursor: default; }

.slot { display: inline-block; min-width: 72px; height: 1.55em; vertical-align: bottom; margin: 0 2px; border-bottom: 2px solid var(--faint); text-align: center; cursor: pointer; }
.slot.filled { border: 2px solid var(--border); border-bottom-width: 3px; border-radius: 8px; padding: 0 8px; background: var(--card); color: var(--text); min-width: 0; line-height: 1.35; }
.slot.active { border-bottom-color: var(--blue); }
.slot.right { border-color: var(--green-d); color: var(--green); }
.slot.wrong { border-color: var(--red-d); color: var(--red); }
.slot-input { display: inline-block; font-family: var(--mono); font-size: 14.5px; color: var(--text); background: var(--card); border: 2px solid var(--border); border-radius: 8px; padding: 1px 8px; min-width: 120px; outline: none; }
.slot-input:focus { border-color: var(--blue); }
.slot-input.wide { width: 100%; min-width: 0; }

.bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
.tile {
  position: relative; padding: 10px 16px; border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 12px; background: none; color: var(--text);
  font-family: var(--mono); font-size: 15px; font-weight: 600; cursor: pointer; white-space: pre; text-align: left;
}
.tile:hover { background: var(--bg-2); }
.tile.used { color: transparent; background: var(--border); border-color: var(--border); cursor: default; }
.order-answer { min-height: 180px; padding: 12px; border-radius: 16px; border: 2px dashed var(--border); display: flex; flex-direction: column; gap: 8px; }
.order-answer:empty::before { content: 'Tippe die Zeilen in der richtigen Reihenfolge an'; color: var(--faint); margin: auto; font-size: 15px; }
.order-answer .tile { width: 100%; border-color: #3f4f58; }
.order-bank { flex-direction: column; align-items: stretch; }
.order-bank .tile { width: 100%; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.match .col { display: flex; flex-direction: column; gap: 14px; }
.match .opt { justify-content: flex-start; min-height: 56px; font-family: var(--mono); font-size: 15px; }
.match .col.r .opt { font-family: var(--font); }
.match .opt.done { opacity: .35; border-color: var(--border); background: none; color: var(--muted); }
.match .opt.flash-wrong { animation: shake .35s; border-color: var(--red-d); color: var(--red); }
.match .opt.flash-right { border-color: var(--green-d); color: var(--green); background: var(--green-bg); }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.lesson-foot { position: fixed; left: 0; right: 0; bottom: 0; border-top: 2px solid var(--border); background: var(--bg); z-index: 10; }
.lesson-foot.right { background: var(--green-bg); border-color: var(--green-bg); }
.lesson-foot.wrong { background: var(--red-bg); border-color: var(--red-bg); }
.foot-inner { max-width: 1040px; margin: 0 auto; min-height: 140px; padding: 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.foot-inner .btn { min-width: 160px; }
.feedback { display: flex; align-items: center; gap: 18px; flex: 1; min-width: 0; animation: slideup .2s ease-out; }
@keyframes slideup { from { opacity: 0; transform: translateY(12px); } }
.feedback .badge { flex: none; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, currentColor 16%, transparent); border: 3px solid color-mix(in srgb, currentColor 45%, transparent); }
.feedback .badge svg { width: 38px; height: 38px; }
.feedback h3 { margin: 0 0 6px; font-size: 24px; font-weight: 900; }
.feedback .sol { font-family: var(--mono); white-space: pre-wrap; font-size: 14px; font-weight: 600; margin-bottom: 6px; max-height: 120px; overflow: auto; }
.feedback .exp { font-size: 15px; font-weight: 700; opacity: .9; }
.lesson-foot.hint { background: #3a3317; border-color: #3a3317; }
.lesson-foot.hint .feedback { color: var(--yellow); }
.lesson-foot.hint .btn { --c: var(--yellow); --cd: var(--yellow-d); }
.feedback .hint-line { display: flex; gap: 8px; align-items: flex-start; margin-top: 4px; }
.feedback .hint-line svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--yellow); }
.feedback .hint-line code { font-family: var(--mono); background: rgba(0,0,0,.25); padding: 1px 6px; border-radius: 6px; }
.opt.out { opacity: .3; text-decoration: line-through; cursor: not-allowed; }
.lesson-foot.right .feedback { color: var(--green); }
.lesson-foot.wrong .feedback { color: var(--red); }
.lesson-foot.right .btn { --c: var(--green); --cd: var(--green-d); }
.lesson-foot.wrong .btn { --c: var(--red); --cd: var(--red-d); --fg: #fff; }

/* Ergebnis-Screen */
.result { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 24px 160px; }
.result .mascot { width: 180px; animation: jump .8s ease-in-out infinite alternate; }
@keyframes jump { to { transform: translateY(-10px) rotate(-3deg); } }
.result h1 { font-size: 34px; font-weight: 900; color: var(--yellow); margin: 24px 0 8px; }
.result .sub { color: var(--muted); font-size: 18px; margin-bottom: 30px; }
.result-stats { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.rstat { width: 150px; border-radius: 16px; border: 2px solid var(--c); background: var(--c); overflow: hidden; animation: pop2 .4s both; }
.rstat:nth-child(2) { animation-delay: .12s; } .rstat:nth-child(3) { animation-delay: .24s; }
@keyframes pop2 { from { opacity: 0; transform: scale(.7); } }
.rstat .l { padding: 6px; font-size: 13px; font-weight: 900; letter-spacing: .6px; color: #131f24; text-transform: uppercase; }
.rstat .v { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; border-radius: 14px; background: var(--bg); color: var(--c); font-size: 22px; font-weight: 900; }
.rstat .v svg { width: 24px; height: 24px; }
.big-flame { width: 180px; height: 180px; color: var(--orange); animation: pop2 .5s both; }
.streak-num { font-size: 96px; font-weight: 900; color: var(--orange); line-height: 1; margin-top: -10px; }
.week-dots { display: flex; gap: 12px; justify-content: center; margin: 24px 0; padding: 16px 20px; border: 2px solid var(--border); border-radius: 16px; }
.week-dots div { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.week-dots i { width: 30px; height: 30px; border-radius: 50%; background: var(--border); display: grid; place-items: center; }
.week-dots i.on { background: var(--orange); }
.week-dots i svg { width: 16px; height: 16px; color: #fff; }

/* ───────── Seiten ───────── */
.page-title { font-size: 30px; font-weight: 900; margin: 8px 0 6px; }
.page-sub { color: var(--muted); font-size: 17px; margin: 0 0 28px; line-height: 1.5; }
.hero-card { display: flex; gap: 24px; align-items: center; border: 2px solid var(--border); border-radius: 20px; padding: 24px; margin-bottom: 24px; }
.hero-card .mascot, .hero-card > svg { width: 110px; flex: none; }
.hero-card h2 { margin: 0 0 6px; font-size: 22px; }
.hero-card p { margin: 0 0 16px; color: var(--muted); line-height: 1.5; }
.list-card { border: 2px solid var(--border); border-radius: 20px; overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.list-row + .list-row { border-top: 2px solid var(--border); }
.list-row .ic { width: 52px; height: 52px; flex: none; display: grid; place-items: center; }
.list-row .ic svg { width: 48px; height: 48px; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.list-row .d { color: var(--muted); font-size: 15px; }

.leagues { display: flex; justify-content: center; gap: 12px; margin: 10px 0 20px; }
.leagues svg { width: 54px; height: 60px; opacity: .3; }
.leagues svg.cur { opacity: 1; transform: scale(1.3); margin: 0 10px; }
.lb-row { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-radius: 14px; }
.lb-row.me { background: var(--bg-2); border: 2px solid var(--border); }
.lb-rank { width: 34px; text-align: center; font-size: 18px; font-weight: 900; color: var(--muted); }
.lb-rank.r1 { color: var(--yellow); } .lb-rank.r2 { color: #c0c0c0; } .lb-rank.r3 { color: #cd7f32; }
.avatar { flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--ac, var(--blue)); display: grid; place-items: center; color: #fff; font-size: 20px; font-weight: 900; text-transform: uppercase; box-shadow: inset 0 -4px 0 rgba(0,0,0,.18); }
.avatar.lg { width: 120px; height: 120px; font-size: 52px; box-shadow: inset 0 -8px 0 rgba(0,0,0,.18); }
.lb-name { flex: 1; font-size: 17px; font-weight: 800; }
.lb-name small { display: block; color: var(--muted); font-size: 13px; }
.lb-xp { color: var(--muted); font-weight: 800; }

.profile-head { display: flex; gap: 28px; align-items: center; padding-bottom: 28px; border-bottom: 2px solid var(--border); margin-bottom: 28px; }
.profile-head h1 { margin: 0; font-size: 30px; }
.profile-head .u { color: var(--muted); margin: 4px 0 10px; }
.profile-head .since { color: var(--muted); font-size: 15px; display: flex; gap: 8px; align-items: center; }
.section-title { font-size: 22px; font-weight: 800; margin: 32px 0 14px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat-box { display: flex; gap: 12px; align-items: flex-start; border: 2px solid var(--border); border-radius: 16px; padding: 14px 16px; }
.stat-box svg { width: 28px; height: 28px; flex: none; margin-top: 2px; }
.stat-box .v { font-size: 20px; font-weight: 900; }
.stat-box .l { color: var(--muted); font-size: 14px; }
.chart { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding: 20px 20px 0; border: 2px solid var(--border); border-radius: 16px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.chart .bar i { width: 100%; max-width: 44px; border-radius: 8px 8px 4px 4px; background: var(--yellow); min-height: 4px; transition: height .6s; }
.chart .bar i.zero { background: var(--border); }
.chart .bar span { color: var(--muted); font-size: 12px; padding-bottom: 12px; }
.chart .bar b { font-size: 12px; color: var(--text); }
.ach { display: flex; gap: 18px; align-items: center; padding: 18px 20px; }
.ach + .ach { border-top: 2px solid var(--border); }
.ach-ic { position: relative; width: 70px; height: 78px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--c, var(--border)); box-shadow: 0 4px 0 rgba(0,0,0,.25); color: #fff; }
.ach-ic.off { --c: #37464f; color: #52656d; }
.ach-ic svg { width: 36px; height: 36px; }
.ach-ic small { position: absolute; bottom: 6px; font-size: 11px; font-weight: 900; }
.settings { display: grid; gap: 18px; }
.field label { display: block; font-size: 15px; font-weight: 800; margin-bottom: 8px; }
.input, .field select {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--border); background: var(--bg-2); color: var(--text); font-size: 16px; font-weight: 700; outline: none;
}
.input:focus, .field select:focus { border-color: var(--blue); }
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.colors button { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.colors button.on { border-color: #fff; }
.toggle { display: flex; align-items: center; justify-content: space-between; }
.switch { width: 52px; height: 30px; border-radius: 99px; background: var(--border); position: relative; border: 0; cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: var(--blue); }
.switch.on::after { left: 26px; }

.shop-item { display: flex; gap: 20px; align-items: center; padding: 22px 0; border-top: 2px solid var(--border); }
.shop-item .ic svg { width: 64px; height: 64px; }
.shop-item .grow { flex: 1; }
.shop-item h3 { margin: 0 0 4px; font-size: 19px; }
.shop-item p { margin: 0; color: var(--muted); }
.shop-item small { color: var(--faint); }
.price { display: inline-flex; align-items: center; gap: 6px; color: var(--blue); }
.price svg { width: 20px; height: 20px; }

/* ───────── Landing / Onboarding ───────── */
.landing { min-height: 100vh; display: flex; flex-direction: column; }
.landing header { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 1000px; margin: 0 auto; padding: 16px 24px; }
.landing .hero { flex: 1; display: flex; align-items: center; justify-content: center; gap: 70px; padding: 40px 24px; }
.landing .hero .art { width: 360px; max-width: 70vw; }
.landing .hero .copy { max-width: 420px; text-align: center; }
.landing .hero h1 { font-size: 32px; line-height: 1.3; font-weight: 800; margin: 0 0 36px; }
.landing .hero .btn { width: 100%; margin-bottom: 14px; }
.landing .langs { border-top: 2px solid var(--border); display: flex; justify-content: center; gap: 36px; padding: 20px; flex-wrap: wrap; }
.landing .langs span { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
.landing .langs svg { width: 32px; height: 32px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; max-width: 1000px; margin: 0 auto; padding: 50px 24px 70px; }
.feature { border: 2px solid var(--border); border-radius: 20px; padding: 24px; }
.feature svg { width: 44px; height: 44px; }
.feature h3 { margin: 12px 0 6px; font-size: 19px; }
.feature p { margin: 0; color: var(--muted); line-height: 1.5; }

.onb { min-height: 100vh; display: flex; flex-direction: column; }
.onb-top { display: flex; align-items: center; gap: 20px; width: 100%; max-width: 1080px; margin: 0 auto; padding: 36px 24px 0; }
.onb-top .progress { flex: 1; }
.onb-top .progress > i { --c: var(--green); }
.onb-body { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 40px 24px 160px; }
.onb-body .speech { margin-bottom: 44px; }
.onb-body .speech .mascot { width: 100px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 760px; margin: 0 auto; }
.choice-grid.three { grid-template-columns: repeat(3, 1fr); max-width: 900px; }
.choice-grid.four { grid-template-columns: repeat(4, 1fr); max-width: 1040px; }
.choice {
  position: relative; display: flex; align-items: center; gap: 16px; padding: 18px 20px; text-align: left;
  border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 16px; background: none; color: var(--text); font-size: 17px; font-weight: 800; cursor: pointer;
}
.choice:hover { background: var(--bg-2); }
.choice .ci { width: 40px; height: 40px; flex: none; display: grid; place-items: center; font-size: 30px; }
.choice .ci svg { width: 40px; height: 40px; }
.choice small { display: block; color: var(--muted); font-size: 14px; font-weight: 700; margin-top: 3px; }
.choice.sel { border-color: #3f85a7; background: var(--blue-bg); color: var(--blue); }
.choice.soon { opacity: .45; cursor: not-allowed; }
.choice .soon-tag { position: absolute; top: 10px; right: 10px; font-size: 11px; font-weight: 900; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); border: 2px solid var(--border); border-radius: 8px; padding: 2px 6px; }
.choice.big { flex-direction: column; text-align: center; padding: 28px 20px; }
.choice.big .ci { width: 80px; height: 80px; }
.choice.big .ci svg { width: 80px; height: 80px; }
.goal-list { display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; border: 2px solid var(--border); border-radius: 16px; overflow: hidden; }
.goal-list button { display: flex; justify-content: space-between; padding: 18px 22px; background: none; border: 0; color: var(--text); font-size: 18px; font-weight: 800; cursor: pointer; }
.goal-list button + button { border-top: 2px solid var(--border); }
.goal-list button span { color: var(--muted); font-weight: 700; }
.goal-list button.sel { background: var(--blue-bg); color: var(--blue); }
.goal-list button.sel span { color: var(--blue); }
.auth-card { width: 100%; max-width: 400px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { text-align: center; font-size: 26px; margin: 0 0 10px; }
.auth-card .err { color: var(--red); text-align: center; min-height: 20px; font-size: 15px; }
.auth-card .hint { color: var(--faint); text-align: center; font-size: 14px; line-height: 1.5; }
.onb-foot { position: fixed; left: 0; right: 0; bottom: 0; border-top: 2px solid var(--border); background: var(--bg); }
.onb-foot .foot-inner { justify-content: flex-end; min-height: 120px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 200; padding: 14px 22px; border-radius: 14px; background: var(--card); border: 2px solid var(--border); font-weight: 800; animation: slideup .2s; max-width: calc(100% - 32px); }
.toast.err { border-color: var(--red-d); color: var(--red); }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--green); animation: spin .8s linear infinite; margin: 30vh auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 30px; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; }

/* ───────── Responsive ───────── */
@media (max-width: 1160px) {
  .side-col { display: none; }
  .sidebar { width: 88px; padding: 24px 12px; }
  .sidebar .logo span, .nav-item span { display: none; }
  .logo { padding: 8px 8px 28px; }
  .nav-item { justify-content: center; padding: 10px; }
  .main { margin-left: 88px; }
}
@media (max-width: 720px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 76px 16px 100px; }
  .mobile-top { display: flex; position: fixed; top: 0; left: 0; right: 0; z-index: 25; background: var(--bg); border-bottom: 2px solid var(--border); padding: 8px 12px; }
  .mobile-top .stats-bar { width: 100%; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 25; background: var(--bg); border-top: 2px solid var(--border); justify-content: space-around; padding: 6px 4px; }
  .bottom-nav .nav-item { padding: 8px; border-radius: 12px; }
  .bottom-nav .nav-item span { display: none; }
  .mascot-side { display: none; }
  .unit-banner { top: 72px; }
  .unit-banner h2 { font-size: 18px; }
  .guide-btn span { display: none; }
  .challenge h1 { font-size: 23px; }
  .foot-inner { flex-direction: column; align-items: stretch; min-height: 0; padding: 16px; gap: 14px; }
  .foot-inner .btn { width: 100%; }
  .feedback .badge { display: none; }
  .lesson-top { padding: 20px 16px 0; gap: 12px; }
  .lesson-body { padding: 20px 16px 220px; }
  .match { gap: 10px; }
  .match .col { gap: 10px; }
  .match .opt { font-size: 13px; padding: 10px; }
  .opt .key { display: none; }
  .choice-grid, .choice-grid.three, .choice-grid.four { grid-template-columns: 1fr; }
  .landing .hero { flex-direction: column; gap: 30px; }
  .landing .hero .art { width: 220px; }
  .features { grid-template-columns: 1fr; }
  .profile-head { flex-direction: column; text-align: center; }
  .stat-grid { grid-template-columns: 1fr; }
  .hero-card { flex-direction: column; text-align: center; }
  .onb-body { padding: 24px 16px 160px; }
  .speech .mascot, .onb-body .speech .mascot { width: 72px; }
  .popover { width: 260px; }
}

/* ═════════════════════ Animationen ═════════════════════ */
:root { --spring: cubic-bezier(.34, 1.56, .64, 1); --out: cubic-bezier(.2, .8, .2, 1); }

/* Seitenwechsel */
.main .center { animation: pageIn .4s var(--out) both; }
.side-col { animation: pageIn .4s .08s var(--out) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } }
.modal { animation: modalIn .38s var(--spring); }
@keyframes modalIn { from { opacity: 0; transform: scale(.82) translateY(20px); } }
.toast { animation: toastIn .4s var(--spring); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 24px) scale(.9); } }
.btn { transition: filter .1s, transform .08s, box-shadow .08s, background-color .2s, color .2s; }

/* Fortschrittsbalken füllen sich beim Laden */
.progress > i { animation: grow 1s var(--out) both; }
@keyframes grow { from { width: 0; } }

/* Lernpfad */
.node-wrap { animation: nodeIn .55s var(--spring) both; animation-delay: calc(var(--i, 0) * 60ms + 80ms); }
@keyframes nodeIn { from { opacity: 0; transform: translateX(var(--x, 0)) translateY(16px) scale(.4); } }
.node { transition: transform .12s, box-shadow .12s, filter .15s; }
.node:hover { filter: brightness(1.1); }
.ring-fill { stroke-dasharray: 100; stroke-dashoffset: 100; animation: ringFill 1.2s .5s var(--out) forwards; }
@keyframes ringFill { to { stroke-dashoffset: calc(100 - var(--p, 0)); } }
.node-wrap.cur .node.chest { animation: wiggle 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes wiggle { 0%, 70%, 100% { rotate: 0deg; } 76% { rotate: -9deg; } 82% { rotate: 8deg; } 88% { rotate: -5deg; } 94% { rotate: 3deg; } }
.unit-banner { animation: pageIn .45s var(--out) both; }
.guide-btn { transition: background .15s, transform .1s; }
.guide-btn:active { transform: translateY(3px); box-shadow: none; }

/* Maskottchen lebt: blinzeln, umschauen, schweben */
.mascot .eyes { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96.5% { transform: scaleY(.08); } }
.mascot-side .mascot, .landing .art .mascot, .hero-card .mascot { animation: float 3.4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-10px) rotate(-2deg); } }
.mascot-side .pupils, .landing .art .pupils { animation: look 7s ease-in-out infinite; }
@keyframes look { 0%, 30%, 100% { transform: translate(0, 0); } 38%, 55% { transform: translate(-4px, -1px); } 63%, 85% { transform: translate(4px, 1px); } }
.speech .mascot { animation: hop .55s var(--spring) both; }
@keyframes hop { 0% { transform: translateY(20px) scale(.7); opacity: 0; } 60% { transform: translateY(-6px) scale(1.04); } }
.bubble { transform-origin: 0 100%; animation: bubbleIn .4s .12s var(--spring) both; }
@keyframes bubbleIn { from { opacity: 0; transform: scale(.6); } }

/* Gestaffeltes Einblenden */
.options .opt, .match .opt, .bank .tile { animation: rise .42s var(--spring) both; animation-delay: calc(var(--d, 0) * 55ms + 120ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.94); } }
.choice, .list-row, .lb-row, .shop-item, .ach, .stat-box, .feature { animation: rise .45s var(--spring) both; }
:is(.choice, .list-row, .lb-row, .shop-item, .ach, .stat-box, .feature):nth-child(2) { animation-delay: .05s; }
:is(.choice, .list-row, .lb-row, .shop-item, .ach, .stat-box, .feature):nth-child(3) { animation-delay: .1s; }
:is(.choice, .list-row, .lb-row, .shop-item, .ach, .stat-box, .feature):nth-child(4) { animation-delay: .15s; }
:is(.choice, .list-row, .lb-row, .shop-item, .ach, .stat-box, .feature):nth-child(5) { animation-delay: .2s; }
:is(.choice, .list-row, .lb-row, .shop-item, .ach, .stat-box, .feature):nth-child(6) { animation-delay: .25s; }
:is(.choice, .list-row, .lb-row, .shop-item, .ach, .stat-box, .feature):nth-child(n+7) { animation-delay: .3s; }
.choice { transition: background .15s, border-color .15s, color .15s, transform .1s; }
.choice:active, .opt:active { transform: translateY(2px); }
.choice.sel, .opt.sel { animation: selPop .28s var(--spring); }
@keyframes selPop { 40% { transform: scale(1.035); } }
.chart .bar i { transform-origin: bottom; animation: barUp .8s var(--spring) both; }
.chart .bar:nth-child(2) i { animation-delay: .05s; } .chart .bar:nth-child(3) i { animation-delay: .1s; } .chart .bar:nth-child(4) i { animation-delay: .15s; }
.chart .bar:nth-child(5) i { animation-delay: .2s; } .chart .bar:nth-child(6) i { animation-delay: .25s; } .chart .bar:nth-child(7) i { animation-delay: .3s; }
@keyframes barUp { from { transform: scaleY(0); } }

/* Lektion */
.challenge { animation: slidein .38s var(--out); }
@keyframes slidein { from { opacity: 0; transform: translateX(48px); } }
.challenge.leaving { animation: slideout .18s ease-in forwards; }
@keyframes slideout { to { opacity: 0; transform: translateX(-48px); } }
.learn-card { animation: cardIn .5s .08s var(--spring) both; }
@keyframes cardIn { from { opacity: 0; transform: scale(.94) translateY(12px); } }
.challenge .kicker svg { animation: sparkle 1.8s ease-in-out infinite; }
@keyframes sparkle { 50% { transform: rotate(-12deg) scale(1.2); filter: drop-shadow(0 0 6px var(--purple)); } }
.opt { transition: background .15s, border-color .15s, color .15s, transform .1s; }
.options .opt.right { animation: rightBounce .5s var(--spring); }
@keyframes rightBounce { 35% { transform: scale(1.04); } }
.options .opt.wrong { animation: shake .42s; }
.bank .tile { transition: transform .12s, background .15s; }
.bank .tile:not(.used):hover { transform: translateY(-2px); }
.bank .tile:not(.used):active { transform: translateY(2px); }
.tile.ghost { display: flex; align-items: center; background: var(--card); border-color: #4b5d66; color: var(--text); padding: 0 10px; white-space: pre; font-size: 15px; box-shadow: 0 8px 20px rgba(0,0,0,.35); }
.slot.right, .slot.wrong { animation: rightBounce .45s var(--spring); }
.order-answer { transition: border-color .2s; }
.lesson-top .progress > i { transition: width .7s var(--spring), background .4s; }
.progress.hot > i { background: linear-gradient(90deg, var(--yellow), var(--orange)); box-shadow: 0 0 14px rgba(255,150,0,.55); }
.progress.boost > i { animation: boost .7s ease-out; }
@keyframes boost { 0% { filter: brightness(1); } 30% { filter: brightness(1.5); } 100% { filter: brightness(1); } }
.combo.pop { animation: comboPop .5s var(--spring); }
@keyframes comboPop { from { opacity: 0; transform: scale(.5) translateY(6px); } }
.lesson-foot { transition: background-color .25s, border-color .25s; }
.feedback .badge { animation: badgePop .5s var(--spring); }
@keyframes badgePop { from { transform: scale(0) rotate(-40deg); } }
.feedback .badge path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .4s .15s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.lesson-foot .foot-inner > .btn { animation: rise .35s var(--spring) both; }
.heart-half { position: fixed; z-index: 500; color: var(--red); pointer-events: none; }
.heart-half svg { width: 100%; height: 100%; }
.heart-half.l { clip-path: inset(0 50% 0 0); animation: halfL .9s cubic-bezier(.5,0,.8,.6) forwards; }
.heart-half.r { clip-path: inset(0 0 0 50%); animation: halfR .9s cubic-bezier(.5,0,.8,.6) forwards; }
@keyframes halfL { 20% { transform: translate(-4px, -6px) rotate(-12deg); } to { transform: translate(-22px, 60px) rotate(-50deg); opacity: 0; } }
@keyframes halfR { 20% { transform: translate(4px, -6px) rotate(12deg); } to { transform: translate(22px, 60px) rotate(50deg); opacity: 0; } }
.hearts-pill svg { transition: transform .2s; }
.hearts-pill.shake svg { animation: heartThump .45s var(--spring); }
@keyframes heartThump { 30% { transform: scale(.6); } }
.match .opt.flash-right { animation: rightBounce .35s var(--spring); }
.match .opt.done { transition: opacity .35s, transform .35s; transform: scale(.97); }

/* Ergebnis & Streak */
.result .mascot { animation: resultIn .7s var(--spring) both, jump .8s .7s ease-in-out infinite alternate; }
@keyframes resultIn { from { opacity: 0; transform: scale(.3) translateY(60px); } }
.result h1 { animation: titleIn .55s .25s var(--spring) both; }
@keyframes titleIn { from { opacity: 0; transform: scale(.4); } }
.result .sub { animation: pageIn .45s .4s var(--out) both; }
.rstat { animation: pop2 .5s .5s var(--spring) both; }
.rstat:nth-child(2) { animation-delay: .62s; } .rstat:nth-child(3) { animation-delay: .74s; }
@keyframes pop2 { from { opacity: 0; transform: scale(.5) translateY(20px); } }
.big-flame { animation: pop2 .6s var(--spring) both; }
.big-flame svg { width: 100%; height: 100%; transform-origin: 50% 100%; animation: flicker 1.3s ease-in-out infinite; filter: drop-shadow(0 0 24px rgba(255,150,0,.45)); }
@keyframes flicker { 0%, 100% { transform: scale(1, 1); } 33% { transform: scale(1.05, .95) skewX(-2deg); } 66% { transform: scale(.96, 1.06) skewX(2deg); } }
.streak-num { height: 1em; overflow: hidden; }
.streak-num .roll { display: inline-block; position: relative; animation: roll .7s .7s var(--spring) both; }
.streak-num .roll::before { content: attr(data-old); position: absolute; left: 0; right: 0; bottom: 100%; }
@keyframes roll { from { transform: translateY(100%); } }
.week-dots i { transition: background .3s; }
.week-dots i.today { animation: dotPop .6s 1.3s var(--spring) both; }
@keyframes dotPop { from { transform: scale(0); } }

/* Truhe */
.chest-anim { position: relative; width: 150px; margin: 0 auto; }
.chest-anim > svg { width: 150px; height: auto; display: block; }
.chest-anim:not(.opened) > svg { animation: chestShake .9s ease-in-out; transform-origin: 50% 90%; }
@keyframes chestShake { 0% { transform: scale(.5); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 40% { rotate: -6deg; } 55% { rotate: 7deg; } 70% { rotate: -9deg; } 85% { rotate: 10deg; } 100% { rotate: 0deg; } }
.chest-anim.opened > svg { animation: chestOpen .5s var(--spring); }
@keyframes chestOpen { 40% { transform: scale(1.18); } }
.gem-burst { position: absolute; left: 50%; top: 40%; width: 26px; height: 26px; margin: -13px 0 0 -13px; color: var(--blue); opacity: 0; pointer-events: none; }
.gem-burst svg { width: 100%; height: 100%; }
.chest-anim.opened .gem-burst { animation: burst 1s var(--d) var(--out) forwards; }
@keyframes burst { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(.3); } 70% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-110px) scale(1.1); } }
.float-text { position: fixed; z-index: 500; transform: translateX(-50%); font-size: 22px; font-weight: 900; pointer-events: none; animation: floatUp 1.1s var(--out) forwards; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
@keyframes floatUp { from { opacity: 0; transform: translate(-50%, 10px) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -6px) scale(1.1); } to { opacity: 0; transform: translate(-50%, -60px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ═════════════════════ Eigenes Select-Menü ═════════════════════ */
.csel { position: relative; }
.csel-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-align: left; cursor: pointer;
  border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 14px; background: var(--bg-2); color: var(--text);
  font-family: inherit; font-size: 16px; font-weight: 800; transition: border-color .15s, background .15s, transform .08s;
}
.csel-btn:hover { background: #1f3139; }
.csel-btn:active { transform: translateY(2px); }
.csel.open .csel-btn, .csel-btn:focus-visible { border-color: #3f85a7; outline: none; }
.csel-label { flex: 1; display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.csel-t { white-space: nowrap; }
.csel-s { color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.csel-chev { width: 22px; height: 22px; flex: none; color: var(--muted); transition: transform .25s var(--spring); }
.csel.open .csel-chev { transform: rotate(180deg); color: var(--blue); }
.csel-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 60; padding: 6px;
  border: 2px solid var(--border); border-radius: 16px; background: var(--bg); box-shadow: 0 16px 40px rgba(0,0,0,.45);
  display: flex; flex-direction: column; gap: 4px;
  opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.97); transform-origin: 50% 0;
  transition: opacity .18s, transform .25s var(--spring), visibility 0s .25s;
}
.csel.open .csel-menu { opacity: 1; visibility: visible; transform: none; transition: opacity .18s, transform .25s var(--spring), visibility 0s; }
.csel-opt {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 2px solid transparent; border-radius: 12px;
  background: none; color: var(--text); font-family: inherit; font-size: 16px; font-weight: 800; text-align: left; cursor: pointer;
}
.csel-opt .csel-t { min-width: 90px; }
.csel-opt .csel-s { flex: 1; }
.csel-opt:hover, .csel-opt:focus-visible { background: var(--bg-2); outline: none; }
.csel-opt.on { background: var(--blue-bg); border-color: #3f85a7; color: var(--blue); }
.csel-opt.on .csel-s { color: #7fc9ee; }
.csel-check { width: 20px; height: 20px; flex: none; opacity: 0; transform: scale(.4); transition: opacity .15s, transform .25s var(--spring); }
.csel-opt.on .csel-check { opacity: 1; transform: none; }
.csel.open .csel-opt { animation: rise .3s var(--spring) both; animation-delay: calc(var(--d, 0) * 35ms); }

/* ═════════════════════ Avatar-Farbwahl ═════════════════════ */
.color-row { display: flex; align-items: center; gap: 18px; }
.avatar { transition: background-color .35s ease; }
.colors button {
  width: 38px; height: 38px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; background: var(--c);
  box-shadow: 0 0 0 0 var(--bg), 0 0 0 0 var(--c), inset 0 -3px 0 rgba(0,0,0,.2);
  transition: box-shadow .2s ease, transform .15s ease;
}
.colors button:hover { transform: translateY(-2px); }
.colors button.on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--c), inset 0 -3px 0 rgba(0,0,0,.2); }
.colors button:focus-visible { outline: 2px solid var(--blue); outline-offset: 6px; }
.colors { gap: 16px; padding: 6px; }

/* ═════════════════════ Shop ═════════════════════ */
.wallet { display: inline-flex; align-items: center; gap: 14px; padding: 14px 22px; margin: 6px 0 12px; border: 2px solid var(--border); border-radius: 16px; color: var(--blue); }
.wallet svg { width: 40px; height: 40px; }
.wallet-v { font-size: 26px; font-weight: 900; line-height: 1; }
.wallet-l { color: var(--muted); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.shop-buy { min-width: 120px; gap: 6px; }
.shop-buy svg { width: 20px; height: 20px; }
.shop-buy.locked { --c: var(--card); --cd: #2a383f; --fg: var(--muted); border: 2px solid var(--border); cursor: not-allowed; }
.shop-status { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 800; color: var(--faint); }
.shop-status.warn { color: var(--orange); }
.shop-status.ok { color: var(--green); }
.list-row .ic > svg { width: 44px; height: 44px; }

/* ═════════════════════ Profilbilder ═════════════════════ */
.avatar.has-img { overflow: hidden; box-shadow: none; }
.avatar.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.avatar.lg-sm { width: 72px; height: 72px; font-size: 30px; }
.avatar.nav { width: 32px; height: 32px; font-size: 14px; flex: none; box-shadow: 0 0 0 2px var(--border); }
.avatar.pop-in { animation: modalIn .4s var(--spring); }
.avatar-edit { position: relative; flex: none; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; }
.avatar-edit .avatar { transition: filter .2s, background-color .35s; }
.avatar-edit:hover .avatar { filter: brightness(.8); }
.avatar-cam { position: absolute; right: 0; bottom: 4px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: #131f24; border: 3px solid var(--bg); transition: transform .2s var(--spring); }
.avatar-cam svg { width: 20px; height: 20px; }
.avatar-edit:hover .avatar-cam { transform: scale(1.12); }
.color-row { align-items: flex-start; }
.avatar-actions { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.avatar-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.avatar-btns .btn svg { flex: none; }
.colors-label { color: var(--muted); font-size: 13px; font-weight: 800; margin-top: 4px; }
.colors { padding: 6px 6px 6px 0; }

/* Zuschneide-Fenster */
.crop-stage { position: relative; width: 280px; height: 280px; margin: 4px auto 18px; border-radius: 20px; overflow: hidden; background: #0d171b; }
.crop-stage canvas { width: 280px; height: 280px; display: block; cursor: grab; touch-action: none; }
.crop-stage canvas.dragging { cursor: grabbing; }
.crop-mask { position: absolute; inset: 0; pointer-events: none; border-radius: 20px; background: radial-gradient(circle at center, transparent 139px, rgba(13,23,27,.72) 140px); }
.crop-mask::after { content: ''; position: absolute; inset: 0; margin: auto; width: 280px; height: 280px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.crop-zoom { display: flex; align-items: center; gap: 14px; max-width: 300px; margin: 0 auto 22px; color: var(--muted); font-size: 22px; font-weight: 900; }
.range { -webkit-appearance: none; appearance: none; flex: 1; height: 12px; border-radius: 99px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, var(--blue) var(--p, 0%), var(--border) var(--p, 0%)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 4px solid var(--blue); box-shadow: 0 3px 0 rgba(0,0,0,.25); transition: transform .15s var(--spring); }
.range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 4px solid var(--blue); }
@media (max-width: 720px) { .color-row { flex-direction: column; } }
/* Eigene Bilder: transparenter Hintergrund */
.avatar.has-img { background: transparent !important; }
/* Schachbrett im Zuschneider zeigt, wo das Bild durchsichtig ist */
.crop-stage.checker { background-color: #1a2a31; background-image: linear-gradient(45deg, #22343c 25%, transparent 25%), linear-gradient(-45deg, #22343c 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #22343c 75%), linear-gradient(-45deg, transparent 75%, #22343c 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }

/* ═════════════════════ Admin-Panel ═════════════════════ */
.adm-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.adm-head > svg { width: 56px; height: 56px; flex: none; }
#adm-q { margin-bottom: 16px; }
.adm-list .avatar { width: 52px; height: 52px; }
.adm-row { align-items: center; }
.adm-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-weight: 900; font-size: 15px; }
.adm-stats span { display: inline-flex; align-items: center; gap: 5px; }
.adm-stats svg { width: 18px; height: 18px; }
.adm-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 900; letter-spacing: .5px; text-transform: uppercase; background: #3a3317; color: var(--yellow); vertical-align: middle; }
.adm-badge svg { width: 14px; height: 14px; }
.adm-badge.me { background: var(--blue-bg); color: var(--blue); }
.adm-target { display: flex; align-items: center; gap: 16px; margin: 6px 0 14px; }
.adm-target .d, .adm-logrow .d { color: var(--muted); font-size: 14px; }
#adm-cur .adm-stats { padding: 12px 16px; border: 2px solid var(--border); border-radius: 14px; font-size: 17px; gap: 8px 20px; margin: 0 0 8px; }
#adm-cur .adm-stats svg { width: 22px; height: 22px; }
.adm-sec { padding: 14px 0; border-top: 2px solid var(--border); }
.adm-sec:first-of-type { border-top: 0; }
.adm-sec-h { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 16px; margin-bottom: 10px; }
.adm-sec-h svg { width: 22px; height: 22px; }
.adm-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.adm-btns .btn.small { min-width: 58px; }
.adm-custom { display: flex; gap: 8px; margin-left: auto; }
.adm-custom .input { width: 110px; padding: 8px 12px; font-size: 15px; }
.adm-custom .input::-webkit-inner-spin-button { opacity: .4; }
.adm-logrow { font-size: 15px; font-weight: 700; padding: 12px 20px; }
.adm-val { color: var(--green); font-weight: 900; }
.adm-val.neg { color: var(--red); }
.pop-in { animation: modalIn .35s var(--spring); }
@media (max-width: 720px) { .adm-custom { margin-left: 0; width: 100%; } .adm-custom .input { flex: 1; width: auto; } .adm-row { flex-wrap: wrap; } }

/* ═════════════════════ Syntax-Hilfe ═════════════════════ */
/* Klappt unterhalb der Aufgabe auf (im Seitenfluss) und verdeckt nichts */
.help-sheet { margin-top: 28px; animation: sheetIn .32s var(--spring); transform-origin: 50% 0; }
.help-sheet.closing { animation: sheetOut .2s ease-in forwards; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(-8px) scale(.97); } }
@keyframes sheetOut { to { opacity: 0; transform: translateY(-6px) scale(.98); } }
.help-inner { padding: 16px 20px 14px; border: 2px solid #2d5f78; border-left-width: 6px; border-radius: 16px; background: #15262e; }
.help-head { display: flex; justify-content: space-between; align-items: center; }
.help-head .kicker { display: flex; align-items: center; gap: 8px; color: var(--blue); font-size: 13px; font-weight: 900; letter-spacing: .8px; text-transform: uppercase; }
.help-head .kicker svg { width: 20px; height: 20px; }
.help-head .icon-btn svg { width: 22px; height: 22px; }
.help-inner h3 { margin: 4px 0 6px; font-size: 18px; }
.help-inner .md { color: #d5e2e8; font-weight: 600; font-size: 15px; margin-bottom: 12px; }
.help-inner .code { font-size: 13.5px; margin: 0; }
.help-note { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
#help { gap: 8px; }
#help.on { --fg: var(--blue); border-color: #3f85a7; background: var(--blue-bg); }
/* Einzelmarkierung beim Code-Sortieren */
.order-answer .tile.right { border-color: var(--green-d); color: var(--green); background: var(--green-bg); }
.order-answer .tile.wrong { border-color: var(--red-d); color: var(--red); background: var(--red-bg); }
.help-sheet .kicker svg { animation: none; }
.help-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 10px; }
.help-rule { padding: 12px; border-radius: 12px; background: rgba(0,0,0,.18); border: 1px solid #27414d; display: flex; flex-direction: column; }
.help-rule h4 { margin: 0 0 4px; font-size: 15px; color: #fff; }
.help-rule .md { font-size: 13.5px; margin-bottom: 10px; flex: 1; }
.help-rule .code { font-size: 12.5px; padding: 10px 12px; white-space: pre; }
.help-rules { grid-template-columns: 1fr; gap: 10px; }
.help-rule { display: grid; grid-template-columns: 1fr 1.15fr; gap: 6px 16px; align-items: center; }
.help-rule h4 { grid-column: 1; }
.help-rule .md { grid-column: 1; margin: 0; }
.help-rule .code { grid-column: 2; grid-row: 1 / span 2; overflow-x: auto; }
@media (max-width: 720px) { .help-rule { grid-template-columns: 1fr; } .help-rule .code { grid-column: 1; grid-row: auto; } }

/* ═════════════════════ Tippen mit Syntax-Farben ═════════════════════ */
.type-wrap { position: relative; display: inline-block; vertical-align: bottom; border-radius: 8px; background: var(--card); }
.type-wrap.wide { display: block; width: 100%; }
.slot-input.hl, .type-hl {
  box-sizing: border-box; font-family: var(--mono); font-size: 14.5px; font-weight: 500; line-height: 1.55;
  letter-spacing: 0; padding: 1px 8px; border: 2px solid transparent; border-radius: 8px; tab-size: 4;
}
.type-hl { position: absolute; inset: 0; white-space: pre; overflow: hidden; pointer-events: none; color: #d7e3e8; }
.slot-input.hl { position: relative; background: transparent; color: transparent; caret-color: #fff; border-color: var(--border); }
.slot-input.hl:focus { border-color: var(--blue); }
.slot-input.hl::placeholder { color: var(--faint); }
.slot-input.hl::selection { background: rgba(28,176,246,.35); color: transparent; }
.slot-input.hl:disabled { color: transparent; }

/* ═════════════════════ Gedächtnisstütze ═════════════════════ */
.help-shape { margin-top: 10px; padding: 14px; border-radius: 12px; background: rgba(0,0,0,.18); border: 1px solid #27414d; }
.help-shape h4 { margin: 0 0 8px; font-size: 15px; color: #fff; }
.shape-code { margin: 0 0 10px; font-size: 16px; letter-spacing: .5px; }
.shape-steps { margin: 0 0 12px; padding-left: 22px; color: #d5e2e8; font-size: 14px; font-weight: 600; line-height: 1.6; }
.shape-steps code { font-family: var(--mono); font-size: .9em; padding: 1px 5px; border-radius: 5px; background: #0d171b; border: 1px solid var(--border); color: #7ee0ff; }
.help-sub { margin: 16px 0 0; color: var(--muted); font-size: 12px; font-weight: 900; letter-spacing: .8px; text-transform: uppercase; }
#shape-letters { gap: 6px; }
.mc-disclaimer { margin: 14px auto 0; max-width: 520px; text-align: center; color: var(--faint); font-size: 12px; font-weight: 700; line-height: 1.5; }

/* ═════════════════════ Passwort vergessen ═════════════════════ */
.auth-mascot { width: 110px; margin: 0 auto -4px; }
.auth-card p.hint b { color: var(--text); }
.code-boxes { display: flex; justify-content: center; gap: 8px; margin: 4px 0; }
.code-box { width: 48px; height: 60px; border-radius: 14px; border: 2px solid var(--border); border-bottom-width: 4px; background: var(--bg-2); color: var(--text); text-align: center; font-family: var(--mono); font-size: 26px; font-weight: 800; outline: none; transition: border-color .15s, transform .12s var(--spring); }
.code-box:focus { border-color: var(--blue); transform: translateY(-2px); }
.auth-card .link-btn:disabled { color: var(--faint); cursor: default; }

/* ═════════════════════ Impressum ═════════════════════ */
.legal { min-height: 100vh; }
.legal-top { display: flex; align-items: center; gap: 16px; max-width: 760px; margin: 0 auto; padding: 28px 24px 0; }
.legal-top .logo { font-size: 26px; }
.legal-body { max-width: 760px; margin: 0 auto; padding: 12px 24px 80px; animation: pageIn .4s var(--out) both; }
.legal-body h1 { font-size: 34px; margin: 18px 0 8px; }
.legal-body h2 { font-size: 19px; margin: 28px 0 8px; color: var(--text); }
.legal-body p { color: #c7d5db; font-weight: 600; line-height: 1.65; margin: 0; }
.legal-body a { color: var(--blue); }
.legal-body .ph { background: #3a3317; color: var(--yellow); padding: 1px 6px; border-radius: 6px; font-weight: 800; }
.legal-warn { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 6px; padding: 14px 16px; border-radius: 14px; background: #3a3317; color: var(--yellow); font-weight: 700; line-height: 1.5; }
.legal-warn code { font-family: var(--mono); background: rgba(0,0,0,.25); padding: 1px 5px; border-radius: 5px; }
.legal-foot { text-align: center; padding: 16px; }
.legal-foot a, .footer-links a { color: var(--faint); cursor: pointer; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; font-size: 12px; }
.legal-foot a:hover, .footer-links a:hover { color: var(--muted); }

/* ═════════════════════ Streak-Flamme ═════════════════════ */
.stat.streak.off .flame-ic .fl-mid, .stat.streak.off .flame-ic .fl-core { fill: #6b7d85; }
.stat.streak.off .flame-ic .fl-shine { opacity: 0; }
.flame-big { width: 100%; height: 100%; overflow: visible; }
.flame-big .fl-l1, .flame-big .fl-l2, .flame-big .fl-l3 { transform-box: fill-box; transform-origin: 50% 100%; }
.flame-big .fl-l1 { animation: flick1 1.6s ease-in-out infinite; }
.flame-big .fl-l2 { animation: flick2 1.2s ease-in-out infinite; }
.flame-big .fl-l3 { animation: flick3 .9s ease-in-out infinite; }
.flame-big .fl-glow { transform-box: fill-box; transform-origin: center; animation: glow 2s ease-in-out infinite; }
.flame-big .fl-face { transform-box: fill-box; transform-origin: center; animation: faceBob 1.6s ease-in-out infinite; }
@keyframes flick1 { 0%, 100% { transform: scale(1, 1) skewX(0); } 30% { transform: scale(1.03, .97) skewX(-2deg); } 65% { transform: scale(.98, 1.04) skewX(2deg); } }
@keyframes flick2 { 0%, 100% { transform: scale(1, 1) skewX(0); } 40% { transform: scale(.96, 1.06) skewX(3deg); } 75% { transform: scale(1.04, .96) skewX(-2deg); } }
@keyframes flick3 { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(.92, 1.1); } }
@keyframes glow { 50% { transform: scale(1.08); opacity: .8; } }
@keyframes faceBob { 50% { transform: translateY(-1.5px); } }
.modal .streak-modal-flame { width: 110px; height: 128px; margin: 0 auto; }

/* ═════════════════════ Streak-Feier ═════════════════════ */
.streak-cel { position: fixed; inset: 0; z-index: 250; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(circle at 50% 38%, #3a2208 0%, #1a1712 38%, #0e1417 75%); color: var(--text); text-align: center; animation: fade .3s ease-out; overflow: hidden; }
.streak-cel.closing { animation: fadeOut .25s ease-in forwards; }
@keyframes fadeOut { to { opacity: 0; } }
.sc-stage { position: relative; width: 220px; height: 240px; display: grid; place-items: center; }
.sc-ember { position: absolute; bottom: 30px; width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle, #ffb020 0%, #ff4b2b 45%, transparent 70%); filter: blur(4px); animation: ember .6s ease-in both, emberPulse 1.4s .6s ease-in-out infinite; }
@keyframes ember { from { transform: scale(.2); opacity: 0; } to { transform: scale(1.4); opacity: .9; } }
@keyframes emberPulse { 50% { transform: scale(1.6); opacity: .6; } }
.sc-flame { position: relative; width: 170px; height: 198px; animation: ignite .9s .25s cubic-bezier(.34,1.56,.64,1) both; filter: drop-shadow(0 0 30px rgba(255,150,0,.55)); }
@keyframes ignite { 0% { transform: scale(0) translateY(60px); opacity: 0; } 60% { transform: scale(1.18) translateY(-6px); opacity: 1; } 100% { transform: scale(1); } }
.sc-wave { position: absolute; left: 50%; top: 58%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 4px solid #ffb020; opacity: 0; animation: wave 1s .45s ease-out forwards; }
.sc-wave.w2 { animation-delay: .65s; border-color: #ff7a00; }
@keyframes wave { 0% { transform: scale(.3); opacity: .9; } 100% { transform: scale(2.6); opacity: 0; } }
.sc-sparks { position: absolute; left: 50%; bottom: 40px; width: 0; height: 0; }
.sc-sparks i { position: absolute; left: 0; bottom: 0; width: 7px; height: 7px; border-radius: 50%; background: #ffd23f; box-shadow: 0 0 8px #ff9600; opacity: 0;
  animation: spark calc(1.6s * var(--s)) calc(.6s + var(--d)) ease-out infinite; }
@keyframes spark { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--x), -190px) scale(.2); opacity: 0; } }
.sc-num { position: relative; margin-top: 4px; font-size: 104px; font-weight: 900; line-height: 1; color: #ff9600; text-shadow: 0 0 30px rgba(255,150,0,.5); height: 1em; overflow: visible; }
/* Zahl rollt: Das äußere Kästchen schneidet ab, innen liegt die alte Zahl über der neuen */
.sc-roll-box { display: inline-block; height: 1.04em; overflow: hidden; vertical-align: top; }
.sc-roll { display: block; position: relative; transform: translateY(100%); transition: transform .7s cubic-bezier(.34,1.56,.64,1); }
.sc-roll::before { content: attr(data-old); position: absolute; left: 0; right: 0; bottom: 100%; }
.streak-cel.counted .sc-roll { transform: translateY(0); }
.sc-plus { position: absolute; right: -54px; top: 4px; font-size: 32px; color: #ffc800; opacity: 0; }
.streak-cel.counted .sc-plus { animation: plusUp 1.1s ease-out forwards; }
@keyframes plusUp { 0% { opacity: 0; transform: translateY(10px) scale(.6); } 25% { opacity: 1; transform: translateY(-6px) scale(1.15); } 100% { opacity: 0; transform: translateY(-40px); } }
.sc-title { margin: 8px 0 18px; font-size: 32px; font-weight: 900; color: #ff9600; animation: pageIn .5s 1.1s var(--out) both; }
.sc-week { display: flex; gap: 12px; padding: 16px 20px; border: 2px solid #3a2a1a; border-radius: 18px; background: rgba(0,0,0,.25); animation: pageIn .5s 1.3s var(--out) both; }
.sc-week div { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 800; }
.sc-week div.today span { color: #ff9600; }
.sc-week i { width: 32px; height: 32px; border-radius: 50%; background: #2c3438; display: grid; place-items: center; transition: background .3s; }
.sc-week i svg { width: 16px; height: 16px; color: #fff; opacity: 0; }
.sc-week i.on { background: linear-gradient(180deg, #ffc800, #ff7a00); box-shadow: 0 0 12px rgba(255,150,0,.5); }
.sc-week i.on svg { opacity: 1; }
.sc-week .today i.on { animation: dotIgnite .6s cubic-bezier(.34,1.56,.64,1); }
@keyframes dotIgnite { 0% { transform: scale(.3); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
.sc-msg { max-width: 380px; margin: 18px 0 0; color: #c7b9a6; font-weight: 700; line-height: 1.5; animation: pageIn .5s 1.6s var(--out) both; }
.sc-test { margin: 10px 0 0; color: var(--yellow); font-size: 13px; font-weight: 800; }
.sc-btn { margin-top: 26px; min-width: 220px; --c: var(--orange); --cd: var(--orange-d); animation: pageIn .4s 2.1s var(--out) both; }
@media (max-width: 720px) { .sc-num { font-size: 84px; } .sc-week { gap: 6px; padding: 12px; } .sc-week i { width: 28px; height: 28px; } }
.sc-num { text-shadow: none; filter: drop-shadow(0 0 22px rgba(255,150,0,.55)); }

/* ═════════════════════ Neue Flamme (ohne Gesicht) ═════════════════════ */
.flame-big .fl-tongue-l, .flame-big .fl-tongue-r, .flame-big .fl-blur { transform-box: fill-box; }
.flame-big .fl-tongue-l { transform-origin: 100% 100%; animation: tongueL 1.3s ease-in-out infinite; }
.flame-big .fl-tongue-r { transform-origin: 0% 100%; animation: tongueR 1.1s ease-in-out infinite; }
.flame-big .fl-blur { transform-origin: 50% 100%; animation: flick1 1.6s ease-in-out infinite; }
.flame-big .fl-hl { animation: hl 1.6s ease-in-out infinite; }
@keyframes tongueL { 0%, 100% { transform: rotate(0) scale(1); } 40% { transform: rotate(-8deg) scale(1.08, .94); } 70% { transform: rotate(5deg) scale(.95, 1.08); } }
@keyframes tongueR { 0%, 100% { transform: rotate(0) scale(1); } 35% { transform: rotate(9deg) scale(.94, 1.1); } 75% { transform: rotate(-5deg) scale(1.05, .95); } }
@keyframes hl { 50% { opacity: .12; } }

/* ═════════════════════ Streak-Feier v2 (Phasen per Klasse: lit → counted → details) ═════════════════════ */
.streak-cel { background: radial-gradient(circle at 50% 36%, #2a1a0a 0%, #151514 40%, #0b1013 78%); }
.sc-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.sc-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; }
.sc-flash { position: fixed; inset: 0; z-index: 3; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 34%, rgba(255,245,210,.95) 0%, rgba(255,160,40,.55) 25%, transparent 60%); }
.streak-cel.lit .sc-flash { animation: flash .6s ease-out; }
@keyframes flash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }
.streak-cel.lit .sc-content { animation: shake .45s ease-out; }

/* Glut lädt sich auf, bis die Flamme zündet */
.sc-ember { bottom: 36px; width: 46px; height: 46px; animation: none; opacity: .9; transform: scale(calc(.5 + var(--charge, 0) * 1.3)); transition: transform .2s var(--spring);
  background: radial-gradient(circle, #fff6d0 0%, #ffb020 30%, #ff4b2b 60%, transparent 72%); filter: blur(1.5px); }
.sc-ember.hit { animation: emberHit .25s ease-out; }
@keyframes emberHit { 50% { filter: blur(1px) brightness(1.8); } }
.streak-cel.lit .sc-ember { animation: emberOut .5s ease-out forwards; }
@keyframes emberOut { to { transform: scale(3); opacity: 0; } }

/* Flamme erscheint erst bei der Zündung */
.sc-flame { animation: none; opacity: 0; transform: scale(0) translateY(40px); width: 180px; height: 225px; }
.streak-cel.lit .sc-flame { animation: igniteV2 .95s cubic-bezier(.34,1.56,.64,1) forwards; }
@keyframes igniteV2 { 0% { opacity: 1; transform: scale(0) translateY(40px); } 45% { transform: scale(1.3, 1.15) translateY(-10px); } 70% { transform: scale(.94, 1.04); } 100% { opacity: 1; transform: scale(1); } }
.sc-stage { width: 240px; height: 250px; }
.sc-wave { animation: none; }
.streak-cel.lit .sc-wave { animation: wave 1s ease-out forwards; }
.streak-cel.lit .sc-wave.w2 { animation: wave 1.1s .15s ease-out forwards; }

/* Zahl: erscheint mit der Zündung (alter Wert), rollt dann hoch und pulsiert */
.sc-num { opacity: 0; transform: scale(.6); transition: opacity .3s, transform .45s var(--spring); }
.streak-cel.lit .sc-num { opacity: 1; transform: scale(1); }
.streak-cel.counted .sc-num { animation: numPulse .6s .25s var(--spring); }
@keyframes numPulse { 40% { transform: scale(1.22); filter: drop-shadow(0 0 40px rgba(255,180,0,.9)); } }

/* Rest erscheint erst in der letzten Phase */
.sc-title, .sc-week, .sc-msg, .sc-test, .sc-btn { opacity: 0; animation: none; }
.streak-cel.details .sc-title { animation: pageIn .5s var(--out) forwards; }
.streak-cel.details .sc-week { animation: pageIn .5s .12s var(--out) forwards; }
.streak-cel.details .sc-msg, .streak-cel.details .sc-test { animation: pageIn .5s .3s var(--out) forwards; }
.streak-cel.details .sc-btn { animation: pageIn .4s .6s var(--out) forwards; }
@keyframes revealIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.streak-cel.details .sc-title { animation: revealIn .5s var(--out) forwards; }
.streak-cel.details .sc-week { animation: revealIn .5s .12s var(--out) forwards; }
.streak-cel.details .sc-msg, .streak-cel.details .sc-test { animation: revealIn .5s .3s var(--out) forwards; }
.streak-cel.details .sc-btn { animation: revealIn .4s .6s var(--out) forwards; }
/* Admin-Protokoll: fester Scrollbereich statt endlos langer Seite */
.adm-log-list { max-height: 340px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.adm-more { display: block; margin: 10px auto 12px; }
#adm-log .empty { padding: 20px; }

/* Profil: Account löschen */
.danger-zone { display: flex; align-items: center; gap: 16px; margin-top: 36px; padding: 18px 20px; border: 2px solid rgba(255,75,75,.35); border-radius: 16px; }
.danger-zone > div { flex: 1; }
.danger-zone .t { font-size: 17px; font-weight: 800; color: var(--red); }
.danger-zone .d { color: var(--muted); font-weight: 600; margin-top: 4px; line-height: 1.45; }
@media (max-width: 560px) { .danger-zone { flex-direction: column; align-items: stretch; } }

/* Sprachumschalter (Startseite / Anmelden) */
.landing-actions { display: flex; align-items: center; gap: 14px; }
.lang-switch { min-width: 44px; height: 36px; padding: 0 10px; border-radius: 12px; border: 2px solid var(--border); background: transparent; color: var(--muted); font: inherit; font-weight: 900; font-size: 13px; letter-spacing: .8px; cursor: pointer; transition: color .15s, border-color .15s, transform .08s; }
.lang-switch:hover { color: var(--text); border-color: var(--muted); }
.lang-switch:active { transform: translateY(2px); }
.onb-top .lang-switch { margin-right: 10px; }

/* Keine Ligaturen: JetBrains Mono würde sonst != als ≠, <= als ≤ und -> als Pfeil zeichnen.
   Im Code müssen genau die Zeichen zu sehen sein, die man auch tippt. */
html, input, textarea, button, select { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }

/* Rückblick in der Lektion */
.lesson-top .prev-btn:disabled { opacity: .25; cursor: default; }
.lesson-top .prev-btn:disabled:hover { color: var(--faint); }
.review-banner { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; padding: 8px 12px; border-radius: 14px; background: rgba(28,176,246,.12); color: var(--blue); font-weight: 800; font-size: 14px; letter-spacing: .4px; text-transform: uppercase; }
.review-banner .icon-btn { color: var(--blue); padding: 2px; }
.review-banner .icon-btn svg { width: 20px; height: 20px; }
.review-banner .icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.flip svg { transform: scaleX(-1); }
.rv-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.rv-actions .btn { min-width: 140px; }
@media (max-width: 700px) { .rv-actions { width: 100%; } .rv-actions .btn { flex: 1; min-width: 0; } }

/* Lange Codezeilen in Kacheln umbrechen statt über den Rand zu laufen (Einrückung bleibt erhalten) */
.tile { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.order-answer .tile { align-self: stretch; }

/* Seitenleiste unten: Sprache & Abmelden */
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 2px solid var(--border); }
.sidebar-foot .nav-item { font-size: 13px; }
.sidebar-foot .nav-item svg { width: 26px; height: 26px; margin: 0 3px; }
.lang-pick { position: relative; }
.lang-pick > .nav-item { width: 100%; }
.lang-menu { position: absolute; left: 0; bottom: calc(100% + 6px); min-width: 180px; padding: 6px; border-radius: 14px; border: 2px solid var(--border); background: var(--bg); box-shadow: 0 10px 30px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 2px; opacity: 0; transform: translateY(6px) scale(.97); transform-origin: bottom left; pointer-events: none; transition: opacity .15s, transform .18s var(--out); z-index: 30; }
.lang-pick.open .lang-menu { opacity: 1; transform: none; pointer-events: auto; }
.lang-menu button { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; font-weight: 800; cursor: pointer; text-align: left; }
.lang-menu button:hover { background: var(--bg-2); }
.lang-menu button.on { color: var(--blue); }
.lang-menu button svg { width: 18px; height: 18px; }
.mobile-only { display: none; }
@media (max-width: 720px) { .mobile-only { display: block; } .settings .btn.mobile-only { display: flex; } }

/* Admin: Sperren */
.adm-badge.banned { background: rgba(255,75,75,.15); color: var(--red); }
.adm-badge.banned svg { width: 14px; height: 14px; }
.adm-count { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; margin-left: 6px; border-radius: 13px; background: var(--red); color: #fff; font-size: 14px; vertical-align: middle; }
.adm-count:empty { display: none; }
.ban-reason { margin-top: 4px; color: var(--muted); font-style: italic; font-weight: 600; overflow-wrap: anywhere; }
.adm-ban-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ban-form { display: grid; grid-template-columns: 1fr 180px auto; gap: 10px; align-items: center; }
.ban-form .input { min-width: 0; }
.ban-box { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 2px solid rgba(255,75,75,.35); background: rgba(255,75,75,.07); }
.adm-note { margin: 8px 0 0; color: var(--faint); font-size: 14px; font-weight: 600; line-height: 1.45; }
@media (max-width: 640px) { .ban-form { grid-template-columns: 1fr; } }

/* Rollen */
.role-badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; padding: 2px 8px 2px 6px; border-radius: 8px; font-size: 11px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; vertical-align: middle; color: var(--rc); background: color-mix(in srgb, var(--rc) 16%, transparent); border: 1.5px solid color-mix(in srgb, var(--rc) 45%, transparent); line-height: 1.4; }
.role-badge svg { width: 12px; height: 12px; }
.profile-head h1 .role-badge { font-size: 13px; padding: 3px 10px 3px 8px; }
.lb-name .role-badge { margin-left: 6px; }
.vip-banner { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 14px 18px; border-radius: 16px; background: rgba(255,200,0,.1); border: 2px solid rgba(255,200,0,.35); color: var(--yellow); font-weight: 800; line-height: 1.4; }
.vip-banner .role-badge { margin-left: 0; flex: none; }
.old-price { opacity: .6; margin-right: 6px; font-weight: 700; }
.role-card { margin-bottom: 14px; }
.role-card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 2px solid var(--border); }
.role-card-head .role-badge { margin-left: 0; font-size: 13px; padding: 3px 10px 3px 8px; }
.role-card-head .d { flex: 1; color: var(--muted); font-weight: 700; }
.role-count { background: var(--rc); color: #131f24; margin-left: 0; }
.role-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.role-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border-radius: 12px; color: var(--rc); background: color-mix(in srgb, var(--rc) 12%, transparent); border: 2px solid color-mix(in srgb, var(--rc) 40%, transparent); }
.role-chip svg { width: 14px; height: 14px; }
.role-chip small { color: var(--muted); font-weight: 700; }
.role-chip button { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.role-chip button:hover { background: rgba(255,255,255,.08); color: var(--red); }
.role-chip button svg { width: 14px; height: 14px; }
.role-form { display: grid; grid-template-columns: 1fr 160px auto; gap: 10px; align-items: center; }
@media (max-width: 640px) { .role-form { grid-template-columns: 1fr; } }

/* Kurs-Umschalter im Lernpfad (Plugins | Mods) */
.track-switch { position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); padding: 5px; margin: 0 0 22px; border-radius: 18px; border: 2px solid var(--border); background: var(--bg-2); }
.track-switch .ts-pill { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px) / var(--n)); border-radius: 13px; background: var(--blue-bg); border: 2px solid #3f85a7; transform: translateX(calc(var(--i) * 100%)); transition: transform .28s var(--spring); }
.track-switch button { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 12px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 15px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; cursor: pointer; transition: color .2s; }
.track-switch button svg { width: 28px; height: 28px; flex: none; }
.track-switch button.on { color: var(--blue); }
.track-switch button:not(.on):hover { color: var(--text); }
@media (max-width: 520px) { .track-switch button { font-size: 13px; gap: 6px; } .track-switch button svg { width: 22px; height: 22px; } }
