/* CodeQuest – Styles */
@font-face { font-family: 'Space Grotesk'; src: url(fonts/space-grotesk-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url(fonts/space-grotesk-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url(fonts/space-grotesk-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url(fonts/jetbrains-mono-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #0b0e1a;
  --bg2: #0f1324;
  --surface: #151a31;
  --surface2: #1c2240;
  --surface3: #252c52;
  --line: #2b3360;
  --text: #eceffa;
  --muted: #8d95bd;
  --gold: #ffc93c;
  --ok: #3ddc97;
  --bad: #ff5c7a;
  --warn: #ffb547;
  --accent: #7c6cff;
  --accent2: #5b4bff;
  --tc: var(--accent);
  --r: 14px;
  --font: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.5; }
body { min-height: 100vh; background:
  radial-gradient(1200px 600px at 85% -10%, rgba(124,108,255,.14), transparent 60%),
  radial-gradient(900px 500px at -10% 10%, rgba(255,122,69,.08), transparent 60%), var(--bg); background-attachment: fixed; }
a { color: inherit; }
code { font-family: var(--mono); font-size: .88em; background: rgba(255,255,255,.07); padding: .1em .35em; border-radius: 6px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.link { color: var(--muted); text-decoration: none; }
.link:hover { color: var(--text); }
[hidden] { display: none !important; }
kbd { font-family: var(--mono); font-size: .7rem; opacity: .7; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 6px; }
::selection { background: rgba(124,108,255,.5); }

/* ---------- Buttons ---------- */
.btn { --b: var(--surface3); --bd: #161b38; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 .95rem var(--font); color: var(--text); background: var(--b); border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; text-decoration: none; box-shadow: 0 3px 0 var(--bd), inset 0 1px 0 rgba(255,255,255,.08); transition: transform .08s, filter .15s, box-shadow .08s; white-space: nowrap; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--bd); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-primary { --b: linear-gradient(180deg, #8b7dff, var(--accent2)); --bd: #3a2db8; }
.btn-danger { --b: linear-gradient(180deg, #ff7690, #e8405f); --bd: #9b1f38; }
.btn-ghost { --b: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-ghost.danger:hover { color: var(--bad); }
.btn-sm { padding: 6px 10px; font-size: .85rem; border-radius: 10px; }
.btn-lg { padding: 14px 22px; font-size: 1.05rem; }
.btn-block { width: 100%; justify-content: flex-start; margin-top: 8px; }
.btn.loading { pointer-events: none; }
.btn.loading::after { content: ''; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface2); color: var(--muted); }
.pill-xp { background: rgba(255,201,60,.15); color: var(--gold); }
.pill-done { background: rgba(61,220,151,.15); color: var(--ok); }

/* ---------- Boot / Auth ---------- */
#app.boot { display: grid; place-items: center; min-height: 100vh; }
.boot-logo { font-weight: 700; font-size: 1.5rem; opacity: .7; animation: pulse 1.2s infinite alternate; }
.logo-mark { display: inline-grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: .85rem; width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--accent), #ff7a45); color: #fff; box-shadow: 0 3px 0 #2b1f8f; }
.logo-mark.big { width: 64px; height: 64px; font-size: 1.3rem; border-radius: 18px; }
#app.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.auth-bg span { position: absolute; font-family: var(--mono); color: var(--accent); opacity: .08; font-size: 2rem; animation: float 14s linear infinite; }
.auth-bg span::before { content: '</>'; }
.auth-bg span:nth-child(3n)::before { content: '{ }'; color: #ff7a45; }
.auth-bg span:nth-child(3n+1)::before { content: '$'; color: var(--gold); }
.auth-bg span:nth-child(4n)::before { content: '#'; color: #4da3ff; }
.auth-bg span:nth-child(1){left:5%;animation-delay:-2s}.auth-bg span:nth-child(2){left:15%;animation-delay:-8s}.auth-bg span:nth-child(3){left:25%;animation-delay:-4s}.auth-bg span:nth-child(4){left:35%;animation-delay:-11s}.auth-bg span:nth-child(5){left:45%;animation-delay:-1s}.auth-bg span:nth-child(6){left:55%;animation-delay:-6s}.auth-bg span:nth-child(7){left:65%;animation-delay:-13s}.auth-bg span:nth-child(8){left:75%;animation-delay:-3s}.auth-bg span:nth-child(9){left:85%;animation-delay:-9s}.auth-bg span:nth-child(10){left:95%;animation-delay:-5s}.auth-bg span:nth-child(11){left:10%;animation-delay:-12s}.auth-bg span:nth-child(12){left:30%;animation-delay:-7s}.auth-bg span:nth-child(13){left:50%;animation-delay:-10s}.auth-bg span:nth-child(14){left:70%;animation-delay:-2.5s}.auth-bg span:nth-child(15){left:90%;animation-delay:-6.5s}.auth-bg span:nth-child(16){left:20%;animation-delay:-9.5s}.auth-bg span:nth-child(17){left:60%;animation-delay:-4.5s}.auth-bg span:nth-child(18){left:80%;animation-delay:-11.5s}
@keyframes float { from { transform: translateY(110vh) rotate(0); } to { transform: translateY(-20vh) rotate(40deg); } }
.auth-card { position: relative; width: min(420px, 100%); background: rgba(21,26,49,.92); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 22px; padding: 32px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.auth-brand { display: flex; gap: 16px; align-items: center; margin-bottom: 24px; }
.auth-brand h1 { margin: 0; font-size: 2rem; }
.auth-brand p { margin: 0; color: var(--muted); }
.setup-note { background: rgba(124,108,255,.12); border: 1px solid rgba(124,108,255,.35); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: .92rem; }

/* ---------- Formulare ---------- */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: .88rem; font-weight: 600; color: var(--muted); }
.form input, .form select, .form textarea { font: 500 1rem var(--font); color: var(--text); background: var(--bg2); border: 2px solid var(--line); border-radius: 11px; padding: 11px 13px; outline: none; transition: border-color .15s; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--accent); }
.form-error { color: var(--bad); margin: 0; font-weight: 600; font-size: .9rem; }

/* ---------- Shell ---------- */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 24px; padding: 10px 24px; background: rgba(11,14,26,.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 600; padding: 8px 12px; border-radius: 10px; }
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.active { color: var(--text); background: var(--surface2); }
.nav-admin { color: var(--gold) !important; }
.hud { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.hud-combo { display: flex; align-items: center; gap: 4px; font-weight: 700; padding: 6px 10px; border-radius: 10px; background: var(--surface); filter: grayscale(1); opacity: .6; transition: .3s; }
.hud-combo.hot { filter: none; opacity: 1; background: rgba(255,122,69,.15); color: #ffa36f; }
.hud-combo.hot .flame { animation: flicker .6s infinite alternate; display: inline-block; }
@keyframes flicker { to { transform: scale(1.18) rotate(-6deg); } }
.hud-level { display: flex; align-items: center; gap: 10px; }
.hud-level.pulse .hud-lvl { animation: pop .6s; }
@keyframes pop { 40% { transform: scale(1.35); } }
.hud-lvl { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; font-weight: 700; background: radial-gradient(circle at 30% 30%, #ffe08a, var(--gold) 55%, #d99a00); color: #2b1d00; box-shadow: 0 0 0 3px rgba(255,201,60,.2); }
.hud-xp { display: grid; gap: 3px; width: 150px; }
.hud-xp small { color: var(--muted); font-size: .72rem; }
.bar { height: 8px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #ff9d3c); border-radius: inherit; transition: width .8s cubic-bezier(.2,.9,.3,1.2); }
.avatar { width: 38px; height: 38px; border-radius: 12px; border: 0; cursor: pointer; font: 700 1rem var(--font); color: #fff; background: linear-gradient(135deg, #4da3ff, var(--accent)); display: grid; place-items: center; flex-shrink: 0; }
.avatar.big { width: 52px; height: 52px; font-size: 1.3rem; border-radius: 16px; }
main#view { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }
body.wide main#view { max-width: 1600px; }

/* ---------- Hub ---------- */
.hub-hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; background: linear-gradient(135deg, var(--surface), var(--surface2)); border: 1px solid var(--line); border-radius: 24px; padding: 32px; margin-bottom: 36px; position: relative; overflow: hidden; }
.hub-hero::after { content: '</>'; position: absolute; right: -10px; bottom: -40px; font: 700 180px var(--mono); color: rgba(255,255,255,.025); pointer-events: none; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .8rem; letter-spacing: .12em; }
.hero-greet h1 { font-size: clamp(2rem, 4vw, 3rem); margin: 0; }
.rank-line { color: var(--gold); font-weight: 600; margin: 4px 0 16px; }
.rank-chip { background: var(--gold); color: #2b1d00; padding: 2px 8px; border-radius: 8px; margin-right: 6px; font-size: .85rem; }
.xpbar { position: relative; height: 26px; background: var(--bg2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.xpbar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--gold), #ff9d3c); border-radius: inherit; }
.xpbar span { position: relative; display: block; text-align: center; font-size: .8rem; font-weight: 700; line-height: 24px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.hero-actions { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 20px; align-items: center; justify-content: flex-end; }
.stat-ring { position: relative; flex-shrink: 0; }
.ring { transform: rotate(-90deg); display: block; }
.ring circle { fill: none; }
.ring-bg { stroke: var(--bg2); }
.ring-fg { stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.15; }
.ring-label b { font-size: 1.5rem; }
.ring-label small { color: var(--muted); font-size: .72rem; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-stats div { background: var(--bg2); border-radius: 12px; padding: 10px 12px; border: 1px solid var(--line); min-width: 120px; }
.mini-stats small { display: block; color: var(--muted); font-size: .75rem; }
.mini-stats b { font-size: 1.05rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2, .section-head h1 { margin: 0; }
.track-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; margin-bottom: 36px; }
.track-card { position: relative; display: flex; flex-direction: column; text-decoration: none; background: var(--surface); border: 2px solid var(--line); border-radius: 20px; padding: 20px; transition: transform .2s, border-color .2s, box-shadow .2s; overflow: hidden; }
.track-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--tc); }
.track-card:hover { transform: translateY(-4px); border-color: var(--tc); box-shadow: 0 14px 40px -12px var(--tc); }
.tc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tc-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; font: 700 1.05rem var(--mono); color: #0b0e1a; background: var(--tc); box-shadow: 0 4px 0 rgba(0,0,0,.35); }
.tc-icon.big { width: 72px; height: 72px; font-size: 1.4rem; border-radius: 20px; flex-shrink: 0; }
.tc-ring { position: relative; }
.tc-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: .78rem; }
.track-card h3 { font-size: 1.35rem; margin-bottom: 4px; }
.track-card p { margin: 0 0 14px; color: var(--muted); font-size: .92rem; flex: 1; }
.tc-foot { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); font-weight: 600; }
.tc-next { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .85rem; color: var(--tc); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-lower { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 18px; }
.panel.empty { text-align: center; padding: 40px 20px; }
.panel h3 { margin-top: 0; }
.badge-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.bdg { font-size: 1.5rem; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--bg2); filter: grayscale(1) brightness(.6); opacity: .5; }
.bdg.on { filter: none; opacity: 1; background: rgba(255,201,60,.12); box-shadow: inset 0 0 0 1px rgba(255,201,60,.35); }
.hall-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.hall-list li { display: grid; grid-template-columns: 34px 1fr auto; gap: 2px 10px; align-items: center; background: var(--bg2); padding: 8px 12px; border-radius: 10px; }
.hall-pos { font-size: 1.2rem; text-align: center; grid-row: span 2; }
.hall-name { font-weight: 700; }
.hall-xp { color: var(--gold); font-weight: 700; text-align: right; grid-row: span 2; }
.hall-meta { color: var(--muted); font-size: .78rem; }
.hall-you { margin: 12px 0 0; font-size: .92rem; }

/* ---------- Track-Karte ---------- */
.back { display: inline-block; color: var(--muted); text-decoration: none; margin-bottom: 12px; font-weight: 600; }
.back:hover { color: var(--text); }
.track-head { margin-bottom: 30px; }
.th-main { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; }
.th-main h1 { margin: 0; }
.th-main p { margin: 4px 0 0; color: var(--muted); max-width: 720px; }
.track-head .xpbar i { background: var(--tc); }
.chapters { display: grid; gap: 22px; }
.chapter { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px; position: relative; }
.chapter.done { border-color: color-mix(in srgb, var(--tc) 45%, var(--line)); }
.chapter.locked { opacity: .55; }
.ch-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.ch-head h2 { font-size: 1.3rem; margin: 0 0 2px; }
.ch-head p { margin: 0; font-size: .93rem; }
.ch-num { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; font-weight: 700; background: var(--surface3); }
.chapter.done .ch-num { background: var(--tc); color: #0b0e1a; }
.ch-done { font-size: .78rem; color: var(--ok); margin-left: 6px; vertical-align: middle; }
.nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.node { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 14px 10px 12px; border-radius: 16px; background: var(--bg2); border: 2px solid var(--line); text-decoration: none; transition: transform .15s, border-color .15s; }
.node:not(.locked):hover { transform: translateY(-3px); border-color: var(--tc); }
.node.locked { cursor: not-allowed; opacity: .55; }
.node-dot { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--surface3); font: 700 .95rem var(--mono); box-shadow: 0 4px 0 rgba(0,0,0,.35); }
.node-boss .node-dot { width: 56px; height: 56px; font-size: 1.6rem; border-radius: 16px; background: linear-gradient(135deg, #3b2b6e, #2a1f52); }
.node-boss { border-style: dashed; }
.node.done .node-dot { background: var(--tc); color: #0b0e1a; }
.node.current { border-color: var(--tc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc) 22%, transparent); }
.node.current .node-dot { animation: bob 1.4s ease-in-out infinite; background: color-mix(in srgb, var(--tc) 35%, var(--surface3)); }
@keyframes bob { 50% { transform: translateY(-4px); } }
.node-label { font-size: .85rem; font-weight: 600; line-height: 1.25; }
.node-xp { font-size: .72rem; color: var(--gold); font-weight: 700; }

/* ---------- Aufgabe ---------- */
.crumbs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--tc); font-weight: 700; text-decoration: none; }
.task-layout { display: grid; grid-template-columns: minmax(340px, 1fr) minmax(0, 1.55fr); gap: 20px; align-items: start; }
.task-info { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.task-info h1 { font-size: 1.6rem; }
.boss-tag { display: inline-block; font-size: .8rem; padding: 3px 8px; border-radius: 8px; background: linear-gradient(135deg, #ff5c8a, #7c6cff); vertical-align: middle; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.prose { color: #d6dbf2; }
.prose p { margin: 0 0 .8em; }
.prose h4 { margin: 1.1em 0 .4em; color: var(--text); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 .8em; }
.prose li { margin-bottom: .25em; }
.code-block { margin: 0 0 1em; background: #0a0d1a; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; overflow: auto; font: .85rem/1.55 var(--mono); }
.code-block code { background: none; padding: 0; font-size: inherit; white-space: pre; }
.callout { background: rgba(124,108,255,.1); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 0 10px 10px 0; margin: 0 0 1em; font-size: .94rem; }
.callout code { display: inline-block; margin-top: 4px; }
details.given { margin: 0 0 14px; }
details.given summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.goals-title { font-size: 1rem; margin-top: 18px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.goals { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.goals li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; font-size: .93rem; transition: .25s; }
.g-ico { display: grid; place-items: center; width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; font-size: .78rem; font-weight: 700; background: var(--surface3); color: var(--muted); }
.goals li.ok { border-color: rgba(61,220,151,.5); background: rgba(61,220,151,.07); }
.goals li.ok .g-ico { background: var(--ok); color: #05301c; }
.goals li.bad { border-color: rgba(255,92,122,.45); }
.goals li.bad .g-ico { background: var(--bad); color: #fff; }
.hint { background: rgba(255,201,60,.08); border: 1px solid rgba(255,201,60,.3); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; font-size: .93rem; }
.hint b { display: block; color: var(--gold); margin-bottom: 4px; }
.hint p:last-child, .hint pre:last-child { margin-bottom: 0; }
.hint-btn { color: var(--gold); }
.hint-btn small { opacity: .7; font-weight: 500; }
.hint-btn.nudge { animation: nudge 1.2s ease-in-out infinite; background: rgba(255,201,60,.12); }
@keyframes nudge { 50% { box-shadow: 0 0 0 6px rgba(255,201,60,.18); } }

.task-work { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.editor-bar, .action-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg2); }
.editor-bar { border-bottom: 1px solid var(--line); }
.action-bar { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.spacer { flex: 1; }
.file-tab { display: inline-flex; align-items: center; gap: 8px; font: 600 .85rem var(--mono); padding: 6px 12px; background: var(--surface); border-radius: 8px; }
.file-tab .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tc); }
.live-badge { font-size: .8rem; font-weight: 600; color: var(--ok); padding-left: 6px; }
.btn-check { --b: linear-gradient(180deg, #4ee8a6, #1fb77a); --bd: #0d6b45; color: #03281a; }
.editor-host { height: 46vh; min-height: 280px; position: relative; }
.editor-host .CodeMirror { height: 100%; }
.fallback-editor { width: 100%; height: 100%; resize: none; border: 0; outline: 0; padding: 14px; background: #0a0d1a; color: var(--text); font: .92rem/1.6 var(--mono); tab-size: 2; }
.output { display: flex; flex-direction: column; }
.out-tabs { display: flex; gap: 4px; padding: 6px 8px 0; background: var(--bg2); }
.out-tab { font: 600 .85rem var(--font); color: var(--muted); background: transparent; border: 0; padding: 8px 14px; border-radius: 9px 9px 0 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.out-tab.active { background: var(--surface); color: var(--text); }
.badge-count { font-size: .7rem; padding: 0 6px; border-radius: 99px; background: var(--surface3); }
.badge-count.err { background: var(--bad); color: #fff; }
.out-body { height: 34vh; min-height: 220px; position: relative; }
.output.tall .out-body { height: calc(100vh - 290px); min-height: 360px; }
.preview { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.console { height: 100%; overflow: auto; background: #0a0d1a; font: .86rem/1.55 var(--mono); padding: 10px 0; }
.cl { padding: 3px 14px; white-space: pre-wrap; word-break: break-word; border-bottom: 1px solid rgba(255,255,255,.03); }
.cl-muted { color: var(--muted); font-family: var(--font); }
.cl-warn { color: var(--warn); background: rgba(255,181,71,.06); }
.cl-err, .cl-error { color: #ff8aa0; background: rgba(255,92,122,.08); }
.cl-info, .cl-alert { color: #8ec5ff; }
.cl-line { opacity: .7; }
.cl-tip { color: var(--gold); font-family: var(--font); margin-top: 4px; }

/* ---------- Quiz ---------- */
.quiz-wrap { max-width: 760px; margin: 0 auto; }
.quiz-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 30px; border-top: 5px solid var(--tc); }
.quiz-tag { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; font-weight: 700; color: var(--tc); }
.quiz-card h1 { font-size: 1.3rem; color: var(--muted); }
.quiz-q { font-size: 1.4rem; font-weight: 700; margin: 6px 0 20px; line-height: 1.3; }
.quiz-q p { margin: 0 0 .5em; }
.quiz-q .code-block { font-size: .95rem; font-weight: 400; }
.options { display: grid; gap: 10px; }
.option { display: flex; gap: 14px; align-items: center; text-align: left; font: 500 1.02rem var(--font); color: var(--text); background: var(--bg2); border: 2px solid var(--line); border-radius: 14px; padding: 14px 16px; cursor: pointer; transition: .15s; }
.option:hover:not(:disabled) { border-color: var(--tc); transform: translateX(4px); }
.opt-key { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 9px; background: var(--surface3); font-weight: 700; }
.opt-text p { margin: 0; }
.option.right { border-color: var(--ok); background: rgba(61,220,151,.1); }
.option.right .opt-key { background: var(--ok); color: #03281a; }
.option.wrong { border-color: var(--bad); background: rgba(255,92,122,.08); opacity: .7; }
.option.wrong .opt-key { background: var(--bad); }
.option:disabled { cursor: default; }
.explain { margin-top: 18px; padding: 14px 16px; border-radius: 14px; background: rgba(61,220,151,.08); border: 1px solid rgba(61,220,151,.3); }
.explain b { color: var(--ok); }
.explain p { display: inline; }
.quiz-foot { margin-top: 18px; text-align: right; }

.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes pulse { to { opacity: .35; } }

/* ---------- Modal / Toast ---------- */
#modal-root { position: relative; z-index: 100; }
.modal-wrap { position: fixed; inset: 0; background: rgba(5,7,15,.7); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; opacity: 0; transition: opacity .2s; }
.modal-wrap.show { opacity: 1; }
.modal { width: min(460px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.5); transform: scale(.94) translateY(10px); transition: transform .25s cubic-bezier(.2,.9,.3,1.3); }
.modal-wide { width: min(1100px, 100%); }
.modal-wrap.show .modal { transform: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.modal-actions.center { justify-content: center; }
.win { text-align: center; }
.win-burst { font-size: 3rem; animation: pop .7s; }
.win h2 { font-size: 1.9rem; margin: 4px 0; }
.win-xp { font-size: 3.2rem; font-weight: 700; color: var(--gold); line-height: 1; margin: 8px 0; text-shadow: 0 0 30px rgba(255,201,60,.4); animation: pop .8s .1s both; }
.win-xp small { font-size: 1.2rem; }
.win-combo { color: #ffa36f; font-weight: 700; }
.win-lines { list-style: none; padding: 0; margin: 16px 0 0; text-align: left; background: var(--bg2); border-radius: 12px; overflow: hidden; }
.win-lines li { display: flex; justify-content: space-between; padding: 8px 14px; font-size: .92rem; border-bottom: 1px solid var(--line); }
.win-lines li:last-child { border: 0; }
.win-level, .win-chapter { margin-top: 12px; padding: 10px; border-radius: 12px; font-weight: 700; background: rgba(124,108,255,.15); color: #b9b0ff; }
.win-level { background: rgba(255,201,60,.15); color: var(--gold); animation: pop .6s .3s both; }
.win-chapter.gold { background: linear-gradient(135deg, rgba(255,201,60,.25), rgba(255,122,69,.2)); color: var(--gold); }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 10px; justify-items: end; pointer-events: none; }
.toast { max-width: 380px; background: var(--surface2); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 12px 16px; box-shadow: 0 12px 30px rgba(0,0,0,.4); transform: translateX(120%); transition: transform .35s cubic-bezier(.2,.9,.3,1.2); pointer-events: auto; font-size: .93rem; }
.toast.show { transform: none; }
.toast p { display: inline; margin: 0; }
.toast-ok { border-left-color: var(--ok); }
.toast-warn { border-left-color: var(--warn); }
.toast-err { border-left-color: var(--bad); }
.toast-level { border-left-color: var(--gold); }
.toast-badge { border-left-color: var(--gold); background: linear-gradient(135deg, #2a2550, #1c2240); }
.badge-toast { display: flex; gap: 12px; align-items: center; }
.bt-icon { font-size: 2.2rem; animation: pop .6s; }
.badge-toast small { display: block; color: var(--gold); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.badge-toast b { display: block; }
.badge-toast span { font-size: .85rem; color: var(--muted); }
#fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 300; }
.usermenu .um-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }

/* ---------- Abzeichen ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.badge-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; text-align: center; filter: grayscale(1); opacity: .5; }
.badge-card.on { filter: none; opacity: 1; border-color: rgba(255,201,60,.4); background: linear-gradient(180deg, rgba(255,201,60,.08), var(--surface)); }
.bc-icon { font-size: 2.6rem; margin-bottom: 6px; }
.badge-card h3 { font-size: 1.05rem; margin-bottom: 4px; }
.badge-card p { margin: 0 0 8px; font-size: .86rem; color: var(--muted); }
.badge-card small { color: var(--muted); font-size: .78rem; }

/* ---------- Spielwiese ---------- */
.play-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-bottom: 16px; }
.play-head h1 { margin: 0; }
.play-head p { margin: 0; flex: 1; min-width: 240px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.seg a { text-decoration: none; padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.seg a.active { background: var(--surface3); color: var(--text); }
.task-layout.play { grid-template-columns: 1fr 1fr; --tc: var(--ok); }
.task-layout.play .editor-host { height: calc(100vh - 290px); min-height: 360px; }

/* ---------- Admin ---------- */
.admin-tabs { display: flex; gap: 6px; margin-bottom: 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.admin-tabs a { text-decoration: none; padding: 10px 16px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.admin-tabs a.active { color: var(--gold); border-color: var(--gold); }
.loading-block { padding: 40px; text-align: center; color: var(--muted); }
.learner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 18px; margin-bottom: 24px; }
.learner-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; display: grid; gap: 14px; }
.learner-card header { display: flex; gap: 14px; align-items: center; }
.lc-name { flex: 1; min-width: 0; }
.lc-name h3 { margin: 0; }
.lc-name .muted { font-size: .85rem; }
.lc-lvl { text-align: center; line-height: 1; }
.lc-lvl b { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #ffe08a, var(--gold) 55%, #d99a00); color: #2b1d00; font-size: 1.2rem; }
.lc-lvl small { font-size: .7rem; color: var(--muted); }
.online { font-size: .75rem; color: var(--ok); font-weight: 600; margin-left: 6px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpis div { background: var(--bg2); border-radius: 10px; padding: 8px 10px; }
.kpis small, .kpi small { display: block; color: var(--muted); font-size: .73rem; }
.kpis b { font-size: 1.05rem; }
.tbars { display: grid; gap: 6px; }
.tbar { display: grid; grid-template-columns: 90px 1fr 50px; gap: 10px; align-items: center; font-size: .82rem; }
.tbar small { color: var(--muted); text-align: right; }
.lc-now { margin: 0; font-size: .87rem; }
.lc-now small { color: var(--muted); }
.learner-card footer { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; }
.table th.right, .table td.right { text-align: right; }
.table tr.ch-row td { background: var(--bg2); font-weight: 700; color: var(--tc); font-size: .85rem; }
.table tr.row-none td { color: var(--muted); }
.table td.warn { color: var(--warn); font-weight: 700; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi b { display: block; font-size: 1.35rem; margin: 2px 0; }
.kpi span { font-size: .8rem; color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.detail-grid .panel h3:not(:first-child) { margin-top: 22px; }
.daybars { display: flex; gap: 12px; align-items: flex-end; overflow-x: auto; padding-bottom: 4px; }
.daybar { display: grid; justify-items: center; gap: 2px; min-width: 84px; font-size: .78rem; }
.db-col { width: 36px; height: 120px; background: var(--bg2); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.db-col i { display: block; width: 100%; background: linear-gradient(180deg, var(--accent), var(--accent2)); border-radius: 8px; }
.stuck { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.stuck li { background: var(--bg2); border-radius: 10px; padding: 8px 12px; display: grid; }
.stuck span { font-size: .82rem; color: var(--muted); }
details.track-detail summary { cursor: pointer; list-style: none; }
details.track-detail summary::-webkit-details-marker { display: none; }
details.track-detail summary h3 { display: inline; }
details.track-detail summary::before { content: '▸ '; color: var(--tc); }
details.track-detail[open] summary::before { content: '▾ '; }
details.track-detail[open] summary { margin-bottom: 12px; }
.code-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.code-compare h4 { color: var(--muted); }
.code-compare .code-block { max-height: 60vh; }
.mini-tracks { display: flex; gap: 4px; }
.mini-tracks span { min-width: 28px; text-align: center; font-size: .78rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, var(--tc) 22%, transparent); color: var(--tc); }
.xp-cell { position: relative; min-width: 110px; padding: 2px 6px; }
.xp-cell i { position: absolute; inset: 0 auto 0 0; background: rgba(255,201,60,.15); border-radius: 6px; }
.xp-cell b { position: relative; color: var(--gold); }
.checklist { list-style: none; padding: 0; }
.checklist li { padding: 6px 0; }
.checklist li.ok::before { content: '✔ '; color: var(--ok); }
.checklist li.bad::before { content: '✗ '; color: var(--bad); }

/* ---------- CodeMirror-Theme ---------- */
.CodeMirror { font-family: var(--mono); font-size: 14.5px; line-height: 1.6; background: #0a0d1a; color: #e6e9f7; }
.CodeMirror-gutters { background: #0a0d1a; border-right: 1px solid var(--line); }
.CodeMirror-linenumber { color: #4a5285; }
.CodeMirror-cursor { border-left: 2px solid var(--gold); }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: rgba(124,108,255,.3) !important; }
.CodeMirror-activeline-background { background: rgba(255,255,255,.035); }
.CodeMirror-matchingbracket { color: var(--gold) !important; text-decoration: underline; }
.CodeMirror-matchingtag { background: rgba(255,201,60,.15); }
.cm-s-default .cm-keyword { color: #c792ea; }
.cm-s-default .cm-atom, .cm-s-default .cm-number { color: #f78c6c; }
.cm-s-default .cm-def { color: #82aaff; }
.cm-s-default .cm-variable { color: #e6e9f7; }
.cm-s-default .cm-variable-2 { color: #89ddff; }
.cm-s-default .cm-variable-3, .cm-s-default .cm-type { color: #ffcb6b; }
.cm-s-default .cm-property { color: #82aaff; }
.cm-s-default .cm-operator { color: #89ddff; }
.cm-s-default .cm-comment { color: #5c6699; font-style: italic; }
.cm-s-default .cm-string, .cm-s-default .cm-string-2 { color: #c3e88d; }
.cm-s-default .cm-meta { color: #ffcb6b; }
.cm-s-default .cm-qualifier { color: #ffcb6b; }
.cm-s-default .cm-builtin { color: #ffcb6b; }
.cm-s-default .cm-bracket { color: #89ddff; }
.cm-s-default .cm-tag { color: #f07178; }
.cm-s-default .cm-attribute { color: #ffcb6b; }
.cm-s-default .cm-hr { color: #999; }
.cm-s-default .cm-link { color: #82aaff; }
.cm-s-default .cm-error { color: #ff5c7a; }

/* ---------- Responsiv ---------- */
@media (max-width: 1050px) {
  .task-layout, .task-layout.play { grid-template-columns: 1fr; }
  .task-info { position: static; max-height: none; }
  .hub-hero { grid-template-columns: 1fr; }
  .hero-stats { justify-content: flex-start; flex-wrap: wrap; }
  .detail-grid, .hub-lower, .code-compare { grid-template-columns: 1fr; }
  .learner-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .hud-xp { width: 90px; }
  .brand-name { display: none; }
  main#view { padding: 18px 14px 60px; }
  .hub-hero { padding: 22px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .table { font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================================
   v2 – Gamification: Pixel-Art, Weltkarte, Pfad, Boss, Mentor, Shop, Farm
   ===================================================================== */
.px { image-rendering: pixelated; image-rendering: crisp-edges; display: inline-block; vertical-align: middle; }
.bob { animation: bob 1.6s ease-in-out infinite; }
.avatar-px { padding: 0; overflow: hidden; background: linear-gradient(135deg, #2b3360, #1c2240); box-shadow: inset 0 0 0 2px var(--line); }
.avatar-px img { margin-top: 4px; }
.hud-coins { display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border-radius: 10px; background: rgba(255,201,60,.12); color: var(--gold); text-decoration: none; font-weight: 700; }
.hud-coins.pop { animation: pop .5s; }
.coin-toast { display: inline-flex; align-items: center; gap: 6px; }
.toast-coin { border-left-color: var(--gold); }

/* Hub */
.hero-greet { position: relative; }
.hero-avatar { float: left; margin: -6px 18px 0 -6px; position: relative; text-decoration: none; }
.hero-avatar span { position: absolute; right: 0; bottom: 6px; font-size: 1rem; background: var(--surface3); border-radius: 8px; padding: 2px 4px; opacity: 0; transition: .2s; }
.hero-avatar:hover span { opacity: 1; }
.hero-greet .xpbar, .hero-greet .hero-actions { clear: left; }
.mini-stats { grid-template-columns: 1fr 1fr 1fr; }
.hub-lower.three { grid-template-columns: 1.2fr 1fr 1fr; }

/* Weltkarte */
.world { position: relative; height: 420px; border-radius: 24px; overflow: hidden; margin-bottom: 36px; border: 2px solid var(--line);
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.06) 0 2px, transparent 3px) 0 0/48px 48px,
    radial-gradient(circle at 70% 60%, rgba(255,255,255,.05) 0 2px, transparent 3px) 0 0/64px 64px,
    linear-gradient(180deg, #123a6b, #0d2a52 60%, #0b2244); }
.world::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(170deg, transparent 0 22px, rgba(255,255,255,.035) 22px 24px); animation: waves 8s linear infinite; }
@keyframes waves { to { background-position: 0 96px; } }
.world-path { position: absolute; inset: 0; width: 100%; height: 100%; }
.world-path path { fill: none; stroke: rgba(255,230,170,.55); stroke-width: .6; stroke-dasharray: 1.4 1.4; vector-effect: non-scaling-stroke; stroke-width: 4px; }
.island { position: absolute; transform: translate(-50%, -50%); text-decoration: none; display: grid; justify-items: center; gap: 8px; transition: transform .2s; z-index: 1; }
.island:hover { transform: translate(-50%, -54%); }
.isl-land { position: relative; width: 132px; height: 84px; border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%;
  background: radial-gradient(ellipse at 50% 35%, #e8d49a 0 30%, #c9b16f 31% 45%, transparent 46%), radial-gradient(ellipse at 50% 50%, #4caf50 0 58%, #2f7a35 59% 70%, transparent 71%);
  box-shadow: 0 10px 0 rgba(0,0,0,.25), 0 0 0 6px rgba(255,255,255,.06); display: grid; place-items: center; }
.island.cleared .isl-land { box-shadow: 0 10px 0 rgba(0,0,0,.25), 0 0 0 6px var(--gold), 0 0 30px rgba(255,201,60,.5); }
.island.current .isl-land { box-shadow: 0 10px 0 rgba(0,0,0,.25), 0 0 0 6px var(--tc), 0 0 34px var(--tc); }
.isl-icon { display: grid; place-items: center; min-width: 46px; height: 40px; padding: 0 8px; border-radius: 12px; font: 700 .95rem var(--mono); color: #0b0e1a; background: var(--tc); box-shadow: 0 4px 0 rgba(0,0,0,.35); z-index: 1; }
.isl-deco { position: absolute; right: 6px; top: -10px; }
.isl-hero { position: absolute; top: -58px; z-index: 2; filter: drop-shadow(0 4px 0 rgba(0,0,0,.3)); }
.isl-label { background: rgba(11,14,26,.82); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; min-width: 130px; text-align: center; }
.isl-label b { display: block; font-size: .9rem; white-space: nowrap; }
.isl-label .bar { height: 6px; margin: 4px 0 2px; }
.isl-label small { color: var(--muted); font-size: .75rem; }

/* Pfad im Track */
.trail { position: relative; display: grid; gap: 10px; padding-bottom: 40px; }
.trail-banner { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--tc); border-radius: 16px; padding: 16px 20px; margin-top: 26px; }
.trail-banner h2 { margin: 0 0 4px; font-size: 1.25rem; }
.trail-banner p { margin: 0; color: var(--muted); }
.trail-banner.done .ch-num { background: var(--tc); color: #0b0e1a; }
.trail-nodes { display: grid; gap: 6px; padding: 18px 0; }
.pnode-wrap { display: grid; grid-template-columns: 1fr; justify-items: center; transform: translateX(var(--off)); gap: 6px; }
.pnode { position: relative; display: grid; place-items: center; width: 74px; height: 74px; border-radius: 50%; text-decoration: none; background: var(--surface3); color: var(--text); font: 700 1.1rem var(--mono); box-shadow: 0 7px 0 #141936, inset 0 -6px 0 rgba(0,0,0,.18); transition: transform .12s; }
.pnode:not(.locked):hover { transform: translateY(-3px); }
.pnode:not(.locked):active { transform: translateY(4px); box-shadow: 0 3px 0 #141936; }
.pnode.done { background: var(--tc); color: #0b0e1a; box-shadow: 0 7px 0 color-mix(in srgb, var(--tc) 55%, #000); }
.pnode.current { background: color-mix(in srgb, var(--tc) 40%, var(--surface3)); box-shadow: 0 7px 0 #141936, 0 0 0 8px color-mix(in srgb, var(--tc) 25%, transparent); animation: pulse-node 1.6s infinite; }
@keyframes pulse-node { 50% { box-shadow: 0 7px 0 #141936, 0 0 0 14px color-mix(in srgb, var(--tc) 10%, transparent); } }
.pnode.locked { opacity: .45; cursor: not-allowed; }
.pnode-quiz { width: 60px; height: 60px; font-size: 1.2rem; }
.pnode-boss { width: 104px; height: 104px; border-radius: 28px; background: linear-gradient(135deg, #3b2b6e, #22184a); }
.pnode-boss.done { background: linear-gradient(135deg, #3a3f5c, #23273f); }
.pnode-boss .beaten { filter: grayscale(1) brightness(.7); transform: rotate(-12deg); }
.pnode-hero { position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-60%); display: flex; align-items: center; gap: 6px; white-space: nowrap; pointer-events: none; }
.pnode-hero em { font-style: normal; font-size: .75rem; font-weight: 700; background: #fff; color: #11131f; padding: 4px 8px; border-radius: 8px; font-family: var(--font); }
.pnode-label { text-align: center; max-width: 220px; }
.pnode-label b { display: block; font-size: .92rem; }
.pnode-label small { color: var(--muted); font-size: .78rem; }
.trail-end { text-align: center; font-size: 2.4rem; display: grid; gap: 4px; margin-top: 14px; }
.trail-end b { font-size: 1rem; color: var(--gold); }
.stars { color: var(--gold); letter-spacing: 1px; }
.stars .off { color: rgba(255,255,255,.18); }

/* Bosskampf */
.boss-panel { display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, #2a1f52, #1a1638); border: 2px solid #5b4bff55; border-radius: 16px; padding: 12px 16px; margin: 0 0 16px; position: relative; overflow: hidden; }
.bp-monster { position: relative; flex-shrink: 0; animation: bob 2s ease-in-out infinite; }
.bp-monster .monster { filter: drop-shadow(0 6px 0 rgba(0,0,0,.35)); }
.monster.hit { animation: hit .35s; }
@keyframes hit { 20% { transform: translateX(-8px); filter: brightness(3) drop-shadow(0 6px 0 rgba(0,0,0,.35)); } 60% { transform: translateX(6px); } }
.monster.attack { animation: attack .6s; }
@keyframes attack { 40% { transform: scale(1.3) translateX(18px); } }
.bp-fx { position: absolute; inset: 0; pointer-events: none; }
.dmg { position: absolute; top: 10%; font: 800 1.4rem var(--font); color: #ff5c7a; text-shadow: 0 2px 0 #000; animation: dmg .9s forwards; }
@keyframes dmg { to { transform: translateY(-40px); opacity: 0; } }
.bp-info { flex: 1; min-width: 0; }
.bp-info small { color: #ff9ac1; font-weight: 800; letter-spacing: .1em; font-size: .72rem; }
.bp-info b { display: block; font-size: 1.1rem; margin-bottom: 6px; }
.bp-hp { display: flex; align-items: center; gap: 8px; }
.bp-hp-bar { flex: 1; height: 12px; border-radius: 99px; background: #0b0e1a; overflow: hidden; border: 2px solid #000; }
.bp-hp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff5c7a, #ff9a5c); transition: width .5s; }
.bp-hp span { font-size: .78rem; font-weight: 700; white-space: nowrap; }
.bp-hearts { margin-top: 6px; color: #ff5c7a; letter-spacing: 3px; }
.bp-hearts .lost { color: rgba(255,255,255,.15); }
.boss-panel.defeated .bp-monster { animation: none; }
.boss-panel.defeated .monster { filter: grayscale(1) brightness(.6); transform: rotate(80deg) translateY(10px); transition: transform .6s, filter .6s; }
.boss-panel.defeated::after { content: 'BESIEGT!'; position: absolute; right: 14px; top: 10px; font: 800 .9rem var(--font); color: var(--gold); transform: rotate(8deg); }
body.hurt::after { content: ''; position: fixed; inset: 0; background: rgba(255,40,80,.18); pointer-events: none; z-index: 400; animation: hurt .45s forwards; }
@keyframes hurt { to { opacity: 0; } }

/* Mentor */
#mentor { position: fixed; left: 18px; bottom: 18px; z-index: 250; display: flex; align-items: flex-end; gap: 10px; max-width: min(520px, calc(100vw - 36px)); transform: translateY(140%); transition: transform .35s cubic-bezier(.2,.9,.3,1.2); }
#mentor.show { transform: none; }
.m-bot { display: grid; justify-items: center; flex-shrink: 0; }
.m-bot small { font-weight: 800; font-size: .72rem; color: #9aa8ff; background: #1b1f3b; padding: 1px 8px; border-radius: 6px; }
.m-bubble { position: relative; background: #fff; color: #1b1f3b; border-radius: 16px; padding: 14px 16px 12px; box-shadow: 0 6px 0 rgba(0,0,0,.3), 0 20px 50px rgba(0,0,0,.4); cursor: pointer; font-size: .98rem; }
.m-bubble::before { content: ''; position: absolute; left: -10px; bottom: 24px; border: 10px solid transparent; border-right-color: #fff; border-left: 0; }
.m-bubble p { margin: 0 0 10px; line-height: 1.45; min-height: 1.4em; }
.m-bubble code { background: #eef1fb; color: #1b1f3b; }
.m-next { float: right; }
#mentor.mood-alert .m-bubble { background: #fff1f3; }
#mentor.mood-think .m-bubble { background: #fffbe8; }

/* Quests */
.quests { display: grid; gap: 8px; }
.quest { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.q-ico { font-size: 1.4rem; text-align: center; }
.q-body b { font-size: .9rem; display: block; }
.q-body .bar { height: 6px; margin: 6px 0 2px; }
.q-body small { color: var(--muted); font-size: .75rem; }
.q-reward { color: var(--gold); font-weight: 700; font-size: .85rem; display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.quest.done:not(.claimed) { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,201,60,.15); }
.quest.claimed { opacity: .55; }
.quest-reset { margin: 10px 0 0; }

/* Shop */
.shop-head { display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center; background: linear-gradient(135deg, var(--surface), var(--surface2)); border: 1px solid var(--line); border-radius: 24px; padding: 24px 30px; margin-bottom: 28px; }
.avatar-stage { position: relative; display: grid; justify-items: center; }
.avatar-floor { width: 120px; height: 18px; border-radius: 50%; background: rgba(0,0,0,.35); margin-top: -10px; }
.avatar-edit h1 { margin-bottom: 4px; }
.av-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.av-row > span { width: 56px; color: var(--muted); font-size: .85rem; font-weight: 600; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.sw { width: 28px; height: 28px; border-radius: 8px; border: 2px solid rgba(0,0,0,.4); cursor: pointer; box-shadow: inset 0 -3px 0 rgba(0,0,0,.2); }
.sw.on { outline: 3px solid var(--gold); outline-offset: 2px; }
.wallet { display: grid; justify-items: center; gap: 2px; background: rgba(255,201,60,.1); border: 1px solid rgba(255,201,60,.35); border-radius: 18px; padding: 14px 22px; }
.wallet b { font-size: 1.8rem; color: var(--gold); }
.wallet small { color: var(--muted); }
.wallet.sm { display: flex; align-items: center; gap: 8px; padding: 6px 14px; margin-left: auto; }
.wallet.sm b { font-size: 1.2rem; }
.shop-cat h2 { font-size: 1.2rem; margin: 10px 0 12px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.shop-item { display: grid; justify-items: center; gap: 8px; text-align: center; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 14px 10px; }
.shop-item b { font-size: .92rem; }
.shop-item.equipped { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,201,60,.15); }
.shop-item.locked { opacity: .55; }
.si-prev { height: 76px; display: grid; place-items: center; }
.si-lock { font-size: .8rem; color: var(--muted); font-weight: 600; }
.btn-buy { --b: linear-gradient(180deg, #ffd85c, #e6a91a); --bd: #8a5d00; color: #2b1d00; }
.theme-swatch { width: 92px; height: 60px; border-radius: 10px; display: grid; place-items: center; font: 700 .9rem var(--mono); border: 2px solid var(--line); }

/* Farm */
.farm-layout { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(0, 1.2fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.farm-layout.free { grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr) minmax(260px, .7fr); }
.farm-layout .task-info { top: 76px; }
.farm-layout .editor-host { height: 44vh; }
.farm-console { height: 22vh; min-height: 130px; }
.farm-side { position: sticky; top: 76px; }
.farm-stage { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px; }
.farm-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.farm-tab { font: 600 .82rem var(--font); color: var(--muted); background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.farm-tab.active { color: #0b0e1a; background: var(--tc); border-color: var(--tc); }
.farm-canvas-wrap { position: relative; border-radius: 12px; overflow: hidden; background: #1b2a1b; box-shadow: inset 0 0 0 3px rgba(0,0,0,.35); }
.farm-canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.farm-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5,7,15,.35); pointer-events: none; animation: fadein .3s; }
@keyframes fadein { from { opacity: 0; } }
.farm-win, .farm-fail { display: grid; justify-items: center; gap: 2px; background: rgba(11,14,26,.92); padding: 14px 24px; border-radius: 16px; border: 2px solid var(--gold); animation: pop .5s; }
.farm-win .stars { font-size: 2.2rem; }
.farm-win b { font-size: 1.3rem; }
.farm-win small { color: var(--muted); }
.farm-fail { border-color: var(--bad); color: #ff9aaf; font-weight: 700; }
.farm-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.farm-tick { font-size: .85rem; color: var(--muted); }
.farm-tick b { color: var(--text); font-family: var(--mono); }
.farm-speed { display: flex; background: var(--bg2); border-radius: 10px; padding: 3px; }
.farm-speed button { font: 600 .8rem var(--font); background: none; border: 0; color: var(--muted); padding: 4px 9px; border-radius: 7px; cursor: pointer; }
.farm-speed button.active { background: var(--surface3); color: var(--text); }
.farm-inv { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 34px; align-items: center; }
.inv-item { display: inline-flex; align-items: center; gap: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 3px 8px 3px 4px; font-size: .85rem; }
.inv-item small { color: var(--muted); }
.star-goals { font-size: .85rem; color: var(--muted); background: var(--bg2); border-radius: 10px; padding: 8px 12px; margin: -6px 0 14px; }
.star-goals b { color: var(--gold); }
.api-docs { margin: 0 0 14px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.api-docs summary { cursor: pointer; font-weight: 700; font-size: .9rem; }
.api-docs dl { margin: 8px 0 0; display: grid; gap: 4px; font-size: .84rem; }
.api-docs dt { margin-top: 4px; }
.api-docs dd { margin: 0; color: var(--muted); }
.farm-shop .panel { padding: 16px; }
.farm-shop h3 { margin: 0 0 10px; }
.market-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.market-list li { display: grid; grid-template-columns: 26px 1fr auto auto; gap: 8px; align-items: center; font-size: .88rem; }
.market-list small { color: var(--muted); }
.upg { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.upg:last-child { border: 0; }
.upg b { display: block; font-size: .9rem; }
.upg small { color: var(--muted); font-size: .78rem; }
.upg.owned { display: grid; opacity: .7; }
.upg.owned b { color: var(--ok); }
.locked-screen { text-align: center; padding: 60px 20px; display: grid; justify-items: center; gap: 10px; }
.win-coins { display: inline-flex; gap: 6px; align-items: center; color: var(--gold); font-weight: 700; margin-bottom: 4px; }
.win-stars .stars { font-size: 2.4rem; animation: pop .6s; display: inline-block; }
.win-burst .beaten { filter: grayscale(.6); transform: rotate(-20deg); }

/* Editor-Themes */
body.theme-retro .CodeMirror, body.theme-retro .CodeMirror-gutters { background: #050a05; color: #4dff88; }
body.theme-retro .cm-s-default .cm-keyword, body.theme-retro .cm-s-default .cm-tag { color: #b6ff6b; }
body.theme-retro .cm-s-default .cm-string { color: #ffe66b; }
body.theme-retro .cm-s-default .cm-comment { color: #2e8a4f; }
body.theme-retro .cm-s-default .cm-variable, body.theme-retro .cm-s-default .cm-property, body.theme-retro .cm-s-default .cm-def { color: #4dff88; }
body.theme-candy .CodeMirror, body.theme-candy .CodeMirror-gutters { background: #2a1640; color: #ffe1f0; }
body.theme-candy .cm-s-default .cm-keyword, body.theme-candy .cm-s-default .cm-tag { color: #ff9ac1; }
body.theme-candy .cm-s-default .cm-string { color: #9af0ff; }
body.theme-candy .cm-s-default .cm-def, body.theme-candy .cm-s-default .cm-property { color: #ffd28a; }
body.theme-light .CodeMirror, body.theme-light .CodeMirror-gutters { background: #fbfbff; color: #1b1f3b; }
body.theme-light .CodeMirror-linenumber { color: #9aa0c0; }
body.theme-light .CodeMirror-cursor { border-left-color: #5b4bff; }
body.theme-light .cm-s-default .cm-keyword { color: #7c3aed; }
body.theme-light .cm-s-default .cm-string { color: #0f7b3e; }
body.theme-light .cm-s-default .cm-tag { color: #c2185b; }
body.theme-light .cm-s-default .cm-variable { color: #1b1f3b; }
body.theme-light .cm-s-default .cm-def, body.theme-light .cm-s-default .cm-property { color: #1d4ed8; }
body.theme-light .cm-s-default .cm-comment { color: #8a8fb0; }

@media (max-width: 1300px) {
  .farm-layout, .farm-layout.free { grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr); }
  .farm-layout .task-info { grid-column: 1 / -1; position: static; max-height: none; }
  .farm-layout.free .farm-shop { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}
@media (max-width: 1050px) {
  .hub-lower.three { grid-template-columns: 1fr; }
  .shop-head { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .av-row { justify-content: center; }
}
@media (max-width: 860px) {
  .farm-layout, .farm-layout.free { grid-template-columns: 1fr; }
  .farm-side { position: static; }
  .world { height: auto; display: grid; gap: 14px; padding: 20px; }
  .world-path { display: none; }
  .island { position: static; transform: none; grid-template-columns: auto 1fr; justify-items: start; align-items: center; }
  .island:hover { transform: none; }
  .isl-land { width: 96px; height: 62px; }
  .isl-hero { display: none; }
  .pnode-wrap { transform: translateX(calc(var(--off) * .4)); }
  .pnode-hero em { display: none; }
}
