:root {
  --bg: #0b0d1a;
  --panel: #151a30;
  --panel2: #1d2340;
  --line: #2c3460;
  --text: #e8ecff;
  --muted: #8b93c2;
  --accent: #4ef0ff;
  --accent2: #b84dff;
  --good: #58ff8b;
  --bad: #ff5470;
  --warn: #ffbe0b;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pixel: 'Press Start 2P', var(--mono);
  --lh: 21px;
  --pad: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--ui); overflow: hidden; }
body { background: radial-gradient(ellipse at top, #1a1f45 0%, var(--bg) 60%); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code, kbd, pre { font-family: var(--mono); }
code { background: rgba(78, 240, 255, 0.1); color: var(--accent); padding: 1px 5px; border-radius: 4px; font-size: 0.92em; }
kbd { background: #2a3160; border: 1px solid #3d4680; border-bottom-width: 3px; border-radius: 5px; padding: 0 5px; font-size: 0.85em; color: #fff; }
pre { background: #0a0d1c; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-size: 13px; line-height: 1.5; margin: 8px 0; }
pre code { background: none; padding: 0; }

/* ---------- buttons ---------- */
.btn { font-family: var(--ui); font-weight: 800; font-size: 15px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); padding: 9px 16px; border-radius: 10px; cursor: pointer; transition: transform .08s, background .15s, border-color .15s; }
.btn:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #2ee6ff, #1aa9d6); color: #04131c; border-color: #8ff6ff; }
.btn.danger { background: linear-gradient(180deg, #ff6b85, #d63555); border-color: #ff9fb0; color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.big { padding: 13px 26px; font-size: 18px; }
.btn small { opacity: .65; font-weight: 600; margin-left: 4px; }

/* ---------- title ---------- */
.screen { position: fixed; inset: 0; overflow-y: auto; display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; }
.title-wrap { text-align: center; max-width: 980px; width: 100%; margin: auto; }
.logo { font-family: var(--pixel); font-size: clamp(30px, 7vw, 64px); margin: 10px 0 6px; letter-spacing: 2px; color: #fff; text-shadow: 0 0 18px rgba(78,240,255,.6), 4px 4px 0 #b84dff; }
.logo span { color: var(--accent); }
.tagline { color: var(--muted); font-size: 18px; margin: 0 0 6px; }
#title-canvas { max-width: 100%; }
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 10px 0 20px; }
.slot { background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 14px; display: grid; grid-template-columns: 80px 1fr; gap: 10px; text-align: left; align-items: center; transition: border-color .15s, transform .15s; }
.slot:hover { border-color: var(--accent); transform: translateY(-2px); }
.slot.empty { grid-template-columns: 1fr; text-align: center; min-height: 160px; place-items: center; border-style: dashed; }
.slot-empty-label { font-family: var(--pixel); font-size: 13px; line-height: 2; color: var(--muted); }
.slot-empty-label span { font-size: 10px; }
.slot-name { font-weight: 900; font-size: 19px; }
.slot-meta { color: var(--muted); font-size: 13px; }
.slot-btns { grid-column: 1 / -1; display: flex; gap: 8px; }
.slot-btns .primary { flex: 1; }
.foot { max-width: 620px; margin: 0 auto; font-size: 14px; }

/* ---------- creator ---------- */
.creator { display: grid; grid-template-columns: 320px 1fr; gap: 28px; max-width: 960px; width: 100%; margin: auto; background: var(--panel); border: 2px solid var(--line); border-radius: 20px; padding: 24px; }
.creator h2 { margin: 0 0 10px; font-family: var(--pixel); font-size: 15px; line-height: 1.6; }
.cc-left { text-align: center; }
#cc-preview { width: 100%; max-width: 300px; background: linear-gradient(180deg, #1b2148, #0f1330); border-radius: 16px; border: 2px solid var(--line); margin-bottom: 10px; }
.cc-label { display: block; font-weight: 800; margin: 12px 0 6px; font-size: 14px; }
#cc-name { width: 100%; font: 700 18px var(--mono); padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); background: #0a0d1c; color: #fff; outline: none; }
#cc-name:focus { border-color: var(--accent); }
.shake { animation: shake .4s; border-color: var(--bad) !important; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.langs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lang-card { text-align: left; background: #0f1330; border: 2px solid var(--line); border-radius: 14px; padding: 12px; color: var(--text); cursor: pointer; display: grid; grid-template-columns: 34px 1fr; column-gap: 8px; font-family: var(--ui); }
.lang-card .lc-icon { grid-row: span 3; align-self: start; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: rgba(78,240,255,.15); color: var(--accent); font: 800 13px var(--mono); }
.lang-card b { font-size: 17px; }
.lang-card small { color: var(--muted); }
.lang-card code { margin-top: 6px; justify-self: start; }
.lang-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(78,240,255,.2); }
.cc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 26px; height: 26px; border-radius: 8px; border: 2px solid rgba(255,255,255,.15); cursor: pointer; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.opts, .row { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { font-family: var(--ui); font-weight: 700; background: #0f1330; color: var(--text); border: 2px solid var(--line); border-radius: 9px; padding: 5px 11px; cursor: pointer; }
.opt.on { border-color: var(--accent); color: var(--accent); }
.cc-actions { display: flex; justify-content: space-between; margin-top: 20px; }

/* ---------- stage ---------- */
#stage { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); overflow: hidden; border-radius: 6px; box-shadow: 0 0 60px rgba(0,0,0,.6); }
#game { width: 100%; height: 100%; display: block; image-rendering: auto; }
#hud { position: absolute; inset: 0; pointer-events: none; padding: 10px 12px; display: flex; justify-content: space-between; align-items: flex-start; font-size: clamp(11px, calc(14px * var(--s, 1)), 15px); }
.hud-left { display: flex; flex-direction: column; gap: 5px; }
.hud-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.heart { color: #ff4d6d; font-size: 1.6em; text-shadow: 0 2px 0 #000; line-height: 1; }
.heart.empty { color: rgba(255,255,255,.2); }
.hud-level { font-family: var(--pixel); font-size: .7em; background: rgba(0,0,0,.45); padding: 6px 8px; border-radius: 6px; margin-left: 6px; }
.chip { pointer-events: auto; font-family: var(--ui); font-weight: 800; font-size: .9em; background: rgba(10,13,28,.75); color: #fff; border: 1.5px solid rgba(255,255,255,.18); border-radius: 999px; padding: 3px 10px; cursor: default; }
button.chip { cursor: pointer; }
.chip.sp { border-color: var(--warn); color: var(--warn); }
.chip.glitch { border-color: var(--c); color: var(--c); animation: pulse 1.2s infinite; }
.chip.glitch small { color: #fff; opacity: .75; font-weight: 600; }
.chip.hint { opacity: .8; font-weight: 600; }
@keyframes pulse { 50% { box-shadow: 0 0 12px var(--c); } }
.hud-vars { pointer-events: none; background: rgba(10,13,28,.78); border: 1.5px solid rgba(255,224,102,.4); border-radius: 10px; padding: 8px 12px; font-family: var(--mono); font-size: .9em; max-width: 38%; }
.vars-title { font-family: var(--ui); font-weight: 900; color: #ffe066; font-size: .85em; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 3px; }
.var { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vn { color: #ffe066; }
.vv { color: #a5ffb8; }
.comps { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.comp { background: rgba(125,249,255,.12); color: #7df9ff; padding: 1px 7px; border-radius: 6px; font-family: var(--ui); font-weight: 800; }
.comp small { opacity: .7; }
.sign { position: absolute; left: 50%; top: 17%; transform: translateX(-50%); max-width: 70%; background: #f3dfb8; color: #3b2a14; border: 3px solid #8b5e34; border-radius: 10px; padding: 10px 16px; font-weight: 800; font-size: clamp(12px, calc(16px * var(--s, 1)), 17px); text-align: center; box-shadow: 0 6px 0 rgba(0,0,0,.3); pointer-events: none; }
#toasts { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: 60%; }
.toast { background: rgba(14,18,38,.94); border: 2px solid var(--line); border-radius: 10px; padding: 7px 14px; font-size: clamp(12px, calc(14px * var(--s, 1)), 15px); font-weight: 700; animation: tin .25s; text-align: center; }
.toast.good { border-color: var(--good); }
.toast.bad { border-color: var(--bad); }
.toast.info { border-color: var(--accent); }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .4s; }
@keyframes tin { from { opacity: 0; transform: translateY(-10px); } }
.keyhints { position: absolute; right: 10px; bottom: 8px; font-size: 12px; color: rgba(255,255,255,.65); pointer-events: none; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(4,6,16,.72); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.panel { background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 22px 26px; max-width: 520px; width: 100%; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: pop .2s; }
.panel.wide { max-width: 720px; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } }
.panel h2 { margin: 0 0 12px; font-family: var(--pixel); font-size: 16px; line-height: 1.6; color: var(--accent); }
.panel p { line-height: 1.55; }
.btns { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.big-check { font-size: 54px; text-align: center; margin: 0; color: var(--good); }
.unlock { margin-top: 12px; background: linear-gradient(135deg, rgba(255,190,11,.15), rgba(184,77,255,.15)); border: 2px solid var(--warn); border-radius: 12px; padding: 12px; text-align: center; line-height: 1.6; }
.credits { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; background: #0f1330; border-radius: 12px; padding: 12px 16px; }
.credits div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed var(--line); padding: 3px 0; }
.credits span { color: var(--muted); }
.pause-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.pause-grid h4 { margin: 0 0 8px; }
.keys td { padding: 3px 8px 3px 0; font-size: 14px; }
.sp-big { font-size: 22px; margin: 0; }
.skills { display: grid; gap: 8px; margin-top: 10px; }
.skill { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; background: #0f1330; border: 2px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.skill.maxed { border-color: rgba(88,255,139,.45); }
.sk-icon { font: 800 12px var(--mono); color: var(--accent); text-align: center; background: rgba(78,240,255,.12); border-radius: 8px; padding: 8px 0; }
.sk-name { font-weight: 900; }
.sk-lvl { color: var(--warn); letter-spacing: 2px; font-size: 13px; }
.sk-desc { color: var(--muted); font-size: 14px; }

/* ---------- editor ---------- */
#editor { padding: 14px; align-items: stretch; }
.ed { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 14px; width: 100%; max-width: 1400px; margin: 0 auto; height: 100%; }
.ed-task { background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 16px 18px; overflow-y: auto; }
.ed-kicker { font-family: var(--pixel); font-size: 9px; color: var(--accent2); letter-spacing: 1px; }
.ed-task h2 { margin: 6px 0 10px; font-size: 22px; font-weight: 900; }
.ed-desc { line-height: 1.55; font-size: 15px; }
.ed-desc ul { padding-left: 20px; }
.ed-side h4 { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.ed-side .var { font-family: var(--mono); font-size: 13px; }
.fn { display: flex; flex-direction: column; margin-bottom: 6px; }
.fn span { color: var(--muted); font-size: 13px; padding-left: 4px; }
.fn code { justify-self: start; align-self: flex-start; }
.solved-note { color: var(--good); font-weight: 700; }
.corrupt-note { color: #d59bff; font-weight: 700; border: 2px dashed #b84dff; border-radius: 10px; padding: 8px; }
.expect { color: #a5ffb8; }
.hint pre { margin: 4px 0 10px; color: #ffe066; }
#hints { margin-top: 12px; }
.ed-main { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 12px; }
.ed-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.ed-bar .spacer { flex: 1; }
#ed-lang { font: 800 14px var(--ui); background: #0f1330; color: var(--text); border: 2px solid var(--line); border-radius: 8px; padding: 5px 8px; }
#ed-lang-icon { font-size: 20px; }
.code-wrap { flex: 1; min-height: 160px; display: grid; grid-template-columns: 44px 1fr; background: #080b18; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.gutter { font: 14px/var(--lh) var(--mono); color: #4a5385; text-align: right; padding: var(--pad) 8px var(--pad) 0; overflow: hidden; user-select: none; background: #0b0f22; }
.gutter div { height: var(--lh); }
.gutter .err { color: var(--bad); font-weight: 700; }
.code-box { position: relative; overflow: hidden; }
.code-hl, #code { position: absolute; inset: 0; margin: 0; padding: var(--pad); font: 14px/var(--lh) var(--mono); white-space: pre; tab-size: 4; border: 0; border-radius: 0; background: transparent; overflow: auto; letter-spacing: 0; }
.code-hl { color: #d7dcff; pointer-events: none; overflow: hidden; }
#code { color: transparent; caret-color: #fff; resize: none; outline: none; -webkit-text-fill-color: transparent; }
#code::selection { background: rgba(78,240,255,.25); -webkit-text-fill-color: transparent; }
.err-line { position: absolute; left: 0; right: 0; height: var(--lh); background: rgba(255,84,112,.18); border-left: 3px solid var(--bad); pointer-events: none; }
.t-kw { color: #ff7ad9; font-weight: 700; }
.t-str { color: #a5ffb8; }
.t-num { color: #ffbe6b; }
.t-com { color: #5f6aa3; font-style: italic; }
.t-bi { color: #7df9ff; }
.t-api { color: #ffe066; font-weight: 700; }
.t-fn { color: #8fb6ff; }
.t-cls { color: #ffd38f; }
.feedback { margin: 10px 0 0; padding: 0; border-radius: 10px; font-size: 15px; line-height: 1.5; }
.feedback:empty { display: none; }
.feedback.good, .feedback.bad { padding: 10px 14px; }
.feedback.good { background: rgba(88,255,139,.1); border: 2px solid rgba(88,255,139,.5); }
.feedback.bad { background: rgba(255,84,112,.1); border: 2px solid rgba(255,84,112,.5); }
.closing { margin-top: 4px; color: var(--good); font-weight: 800; }
.console-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 10px 0 4px; font-weight: 800; }
.console { background: #05070f; border: 2px solid var(--line); border-radius: 10px; padding: 8px 12px; height: 150px; overflow-y: auto; font: 13px/1.5 var(--mono); }
.c-out { color: #e8ecff; white-space: pre-wrap; }
.c-err { color: #ff8095; white-space: pre-wrap; }
.c-dim { color: var(--muted); }
.c-label { color: var(--accent2); font-weight: 700; margin-top: 4px; }

@media (max-width: 860px) {
  .creator { grid-template-columns: 1fr; }
  .ed { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 100%; }
  #editor { overflow-y: auto; align-items: flex-start; }
  .ed-task { max-height: 40vh; }
  .ed-main { min-height: 70vh; }
  .pause-grid, .credits { grid-template-columns: 1fr; }
  .hud-vars { max-width: 45%; }
}

/* ---------- level map ---------- */
#screen-map { padding: 0; display: block; }
.map { max-width: 1100px; margin: 0 auto; padding: 0 16px 30px; }
.map-top { display: flex; align-items: center; gap: 10px; padding: 14px 0; flex-wrap: wrap; }
.map-top .spacer { flex: 1; }
.map-logo { font-family: var(--pixel); font-size: 18px; color: #fff; text-shadow: 2px 2px 0 #b84dff; }
.map-logo span { color: var(--accent); }
.map-board { position: relative; width: 100%; aspect-ratio: 1000 / 560; background: radial-gradient(ellipse at center, #1b2246 0%, #10142c 75%); border: 3px solid var(--line); border-radius: 20px; overflow: hidden; }
.map-board svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-path { fill: none; stroke: #3a4378; stroke-width: 6; stroke-dasharray: 2 14; stroke-linecap: round; }
.map-path.walked { stroke: var(--accent); stroke-dasharray: none; opacity: .7; }
.map-node { position: absolute; transform: translate(-50%, -50%); background: none; border: 0; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text); font-family: var(--ui); }
.mn-dot { width: clamp(38px, 5.5vw, 60px); height: clamp(38px, 5.5vw, 60px); border-radius: 50%; display: grid; place-items: center; background: #1d2340; border: 4px solid #5a65a8; font-family: var(--pixel); font-size: clamp(11px, 1.5vw, 16px); box-shadow: 0 5px 0 rgba(0,0,0,.45); transition: transform .12s; }
.map-node:hover .mn-dot { transform: scale(1.08); }
.map-node.done .mn-dot { border-color: var(--good); color: var(--good); }
.map-node.current .mn-dot { border-color: var(--accent); box-shadow: 0 5px 0 rgba(0,0,0,.45), 0 0 22px rgba(78,240,255,.6); }
.map-node.sel .mn-dot { background: #2a3366; }
.map-node.locked { cursor: not-allowed; }
.map-node.locked .mn-dot { border-color: #333a63; background: #141834; font-size: clamp(13px, 1.8vw, 20px); }
.mn-label { font-weight: 900; font-size: clamp(10px, 1.4vw, 15px); background: rgba(8,10,24,.75); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.map-node.locked .mn-label { color: var(--muted); }
#map-hero { position: absolute; transform: translate(-50%, -125%); width: clamp(34px, 5vw, 60px); pointer-events: none; animation: hop 1.4s ease-in-out infinite; }
@keyframes hop { 50% { margin-top: -6px; } }
.map-panel { margin-top: 16px; display: flex; align-items: center; gap: 18px; background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 16px 20px; }
.map-panel > div { flex: 1; }
.mp-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); font-weight: 900; }
.mp-title { font-family: var(--pixel); font-size: clamp(14px, 2vw, 18px); margin: 6px 0; line-height: 1.4; }
.mp-sub { color: #cfd5ff; }
@media (max-width: 600px) { .map-panel { flex-direction: column; align-items: stretch; text-align: center; } }
/* in-game topic chip */
.topic-chip { pointer-events: auto; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; background: rgba(10,13,28,.78); border: 1.5px solid rgba(78,240,255,.45); color: #fff; border-radius: 8px; padding: 4px 9px; font-family: var(--ui); font-weight: 800; font-size: 1em; }
.topic-chip:hover { border-color: var(--accent); }
.tc-ch { font-family: var(--pixel); font-size: .6em; color: var(--accent); }
.tc-prog { font-family: var(--mono); font-size: .85em; color: #a5ffb8; }
.tc-map { font-size: .9em; }
.hud-level { background: none !important; padding: 0 !important; font-family: var(--ui) !important; font-size: 1em !important; }
@media (max-width: 900px) {
  .map-grid { grid-template-columns: 1fr; }
  .map-side { position: static; order: -1; }
  .ex-row { grid-template-columns: 1fr auto; }
  .ex-label { grid-column: 1 / -1; font-size: 12px; }
  .chapters { padding-left: 48px; }
  .chapters::before { left: 18px; }
  .ch-node { left: -48px; width: 40px; height: 40px; font-size: 12px; }
}

.map-continue { display: grid; grid-template-columns: 60px 1fr auto; gap: 16px; align-items: center; background: linear-gradient(135deg, rgba(78,240,255,.14), rgba(184,77,255,.14)); border: 2px solid rgba(78,240,255,.55); border-radius: 16px; padding: 16px 20px; margin-bottom: 22px; box-shadow: 0 0 30px rgba(78,240,255,.12); }
.mc-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); font-weight: 900; }
.mc-title { font-family: var(--pixel); font-size: clamp(13px, 2vw, 17px); line-height: 1.5; margin: 4px 0; }
.mc-sub { color: #cfd5ff; }
.map-h { font-family: var(--pixel); font-size: 12px; color: var(--muted); margin: 0 0 14px; letter-spacing: 1px; }
.ch-locked-note { background: rgba(255,190,11,.08); border: 2px dashed rgba(255,190,11,.4); border-radius: 10px; padding: 8px 12px; color: #ffd98a; }
.chapter.locked .ch-head { cursor: pointer; }
.chapter.locked .btn:disabled { opacity: .6; }
@media (max-width: 600px) { .map-continue { grid-template-columns: 1fr; text-align: center; } .map-continue canvas { justify-self: center; } }
.ed-desc pre { white-space: pre-wrap; word-break: break-word; }

/* ---------- tutorial ---------- */
#tutorial { z-index: 70; }
.tut { background: var(--panel); border: 2px solid var(--line); border-radius: 18px; width: 100%; max-width: 820px; max-height: 94vh; overflow-y: auto; padding: 20px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: pop .2s; display: flex; flex-direction: column; gap: 12px; }
.tut-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tut-head h2 { margin: 6px 0 0; font-family: var(--pixel); font-size: 17px; line-height: 1.5; color: var(--accent); }
.tut-body { line-height: 1.6; font-size: 16px; }
.tut-body p { margin: 0 0 10px; }
.tut-body pre { white-space: pre-wrap; }
.cheat { border-collapse: collapse; width: 100%; }
.cheat td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cheat td:first-child { white-space: nowrap; }
.tut-try { background: #0f1330; border: 2px solid rgba(78,240,255,.35); border-radius: 12px; padding: 10px 12px; }
.tut-try-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; color: var(--accent); margin-bottom: 8px; }
.tut-try-head .spacer { flex: 1; }
#tut-code { width: 100%; font: 14px/1.5 var(--mono); background: #080b18; color: #e8ecff; border: 2px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; outline: none; white-space: pre; overflow: auto; tab-size: 4; }
#tut-code:focus { border-color: var(--accent); }
.tut-out { height: auto; min-height: 44px; max-height: 160px; margin-top: 8px; }
.tut-foot { display: flex; align-items: center; gap: 12px; }
.tut-dots { flex: 1; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.tdot { width: 11px; height: 11px; border-radius: 50%; border: 0; background: #3a4378; cursor: pointer; padding: 0; }
.tdot.seen { background: #5a74b8; }
.tdot.on { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.hint { background: rgba(255,224,102,.07); border-left: 3px solid #ffe066; border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; font-size: 14px; line-height: 1.5; }
.hint.similar { border-left-color: var(--accent); background: rgba(78,240,255,.07); }
.hint.similar p { margin: 4px 0; }
.hint.similar pre { color: #d7dcff; margin: 6px 0; }
.mp-btns { display: flex; gap: 10px; align-items: center; }
@media (max-width: 600px) { .mp-btns { flex-direction: column; align-items: stretch; } .tut-foot { flex-wrap: wrap; } }

/* ---------- language save files ---------- */
.slots { grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); }
.title-wrap { max-width: 1180px; }
.lang-slot { grid-template-columns: 70px 1fr; align-content: start; }
.lang-slot.empty { display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 10px; }
.lang-slot .slot-lang { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 17px; }
.lang-slot .slot-empty-label { font-family: var(--ui); font-size: 13px; line-height: 1.5; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.lang-slot .slot-empty-label code { align-self: flex-start; }
.lang-slot canvas { width: 70px; }
.lang-badge { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 6px; border-radius: 7px; background: rgba(78,240,255,.15); color: var(--accent); font: 800 12px var(--mono); }
.cc-lang { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.ed-lang { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; }
.map-langlabel { font-weight: 800; color: var(--muted); }
.lang-slot .slot-empty-label code { max-width: 100%; overflow-wrap: anywhere; font-size: 11.5px; }
.lang-slot.empty .btn { margin-top: auto; }

/* ---------- chapter tabs ---------- */
.map-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.map-tab { flex: 0 1 260px; text-align: left; background: var(--panel); border: 2px solid var(--line); border-bottom-width: 4px; color: var(--text); border-radius: 12px; padding: 8px 14px; cursor: pointer; font: 900 16px var(--ui); display: flex; flex-direction: column; gap: 2px; }
.map-tab small { font-weight: 700; font-size: 12px; color: var(--muted); }
.map-tab.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(78,240,255,.15); }
.map-tab.locked { opacity: .55; }
.map-tab.locked small::before { content: 'Locked · '; }
.map-ch-label { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); font-family: var(--pixel); font-size: clamp(11px, 1.6vw, 16px); color: rgba(255,255,255,.55); letter-spacing: 1px; pointer-events: none; white-space: nowrap; }
.map-board.preview .map-node .mn-dot { opacity: .8; }
.map-preview { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: rgba(8,10,24,.8); border: 2px solid rgba(255,255,255,.25); color: #fff; padding: 6px 14px; border-radius: 999px; font-size: clamp(11px, 1.4vw, 14px); white-space: nowrap; pointer-events: none; }
.map-node.locked { cursor: pointer; }
.map-node.locked.sel .mn-dot { border-color: #9aa3d8; background: #262d55; }
.map-ch-label { background: rgba(8,10,24,.55); padding: 4px 12px; border-radius: 8px; color: rgba(255,255,255,.85); }
.mp-terms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mp-term { font-size: 12px; font-weight: 800; background: rgba(255,255,255,.07); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; color: #cfd5ff; }
.mp-term.solved { color: var(--good); border-color: rgba(88,255,139,.4); }
.mp-why { margin-top: 8px; font-size: 13px; color: var(--muted); }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: grayscale(.6); }
.mn-mini { position: absolute; top: -10px; right: -16px; font: 900 9px var(--ui); letter-spacing: .5px; background: #ff5470; color: #fff; padding: 2px 5px; border-radius: 6px; box-shadow: 0 2px 0 rgba(0,0,0,.4); }
.mp-mini { margin-top: 8px; font-size: 13px; color: #ffb3c0; }
.course-slot { grid-column: 1 / -1; border-style: solid; border-color: rgba(79,208,160,.55); background: linear-gradient(135deg, rgba(79,208,160,.10), rgba(78,140,255,.10)), var(--panel); }
.course-slot.empty { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.course-slot .lang-badge { background: #1f5a4a; color: #a8f0d0; }
.lang-switch { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.ls-btn { font: 900 13px var(--ui); color: var(--text); background: var(--panel); border: 2px solid var(--line); border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.ls-btn.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(78,240,255,.15); }
.map-tabs .lang-switch { margin: 0 0 0 auto; align-self: center; }

.i-stage { display: block; width: 100%; height: 84px; margin: 8px 0 4px; background: linear-gradient(180deg, rgba(125,249,255,.06), rgba(125,249,255,.02)); border: 1px solid var(--line); border-radius: 10px; }
.i-stage.hidden { display: none; }

.tc-prog { font-family: var(--ui); font-weight: 900; }
.lang-slot .slot-empty-label code { white-space: nowrap; overflow-wrap: normal; font-size: 11px; max-width: 100%; overflow: hidden; }
.course-slot .slot-btns { display: flex; justify-content: flex-start; gap: 10px; }
.course-slot .slot-btns .btn { flex: 0 0 auto; }
.course-slot .slot-btns .btn.primary { min-width: 180px; }
.ed-kicker { line-height: 1.7; }

.title-start { margin: 34px 0 10px; }
.title-start .btn { min-width: 220px; font-size: 22px; padding: 14px 40px; }
.title-start.hidden, .title-saves.hidden { display: none; }
.saves-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin: 4px 0 6px; }
.saves-head .btn { justify-self: start; }
.saves-head h2 { margin: 0; font-size: 18px; color: #cfd5ff; }
