/* =====================================================
   slimeleetcode · giao diện "Đêm hacker"
   ===================================================== */
:root {
  --bg: #0A0E17;
  --surface: #0F1624;
  --surface-2: #131D2E;
  --surface-3: #18243A;
  --border: #1E2A3D;
  --border-strong: #2A3B55;
  --text: #D7E3F4;
  --muted: #6F809E;
  --neon: #39FF88;   --neon-d: #1FCB63; --neon-l: rgba(57, 255, 136, .1);  --neon-t: #5CFFA0;
  --violet: #A78BFA; --violet-l: rgba(167, 139, 250, .12); --violet-t: #C4B5FD;
  --blue: #4DA3FF;   --blue-l: rgba(77, 163, 255, .12);   --blue-t: #9CCBFF;
  --red: #FF4D6D;    --red-l: rgba(255, 77, 109, .12);    --red-t: #FF91A5;
  --amber: #FFC23D;  --amber-l: rgba(255, 194, 61, .12);  --amber-t: #FFD77F;
  --code-bg: #070A11;
  --code-text: #E6E9F2;
  --code-muted: #5D6B8A;
  --radius: 16px;
  --font: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --glow: 0 0 0 1px rgba(57, 255, 136, .25), 0 0 22px rgba(57, 255, 136, .22);
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(57, 255, 136, .08), transparent 70%),
    linear-gradient(rgba(57, 255, 136, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 136, .035) 1px, transparent 1px);
  background-size: 100% 100%, 28px 28px, 28px 28px;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(57, 255, 136, .3); }
a { color: var(--neon); text-decoration: none; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 .8em; }
b, strong { font-weight: 700; }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-3); color: var(--neon-t); padding: .1em .4em; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); white-space: pre-wrap; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ============ Nút ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  padding: .6em 1.1em; min-height: 44px;
  border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .08s, border-color .15s, box-shadow .2s, background .15s;
}
.btn:hover { border-color: var(--neon); box-shadow: var(--glow); }
.btn:active:not([disabled]) { transform: translateY(2px) scale(.98); }
.btn[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; border-color: var(--border-strong); }
.btn small { opacity: .7; }
.btn-primary { background: var(--neon); border-color: var(--neon); color: #04210F; box-shadow: 0 0 18px rgba(57, 255, 136, .35); }
.btn-primary:hover { background: #5CFFA0; box-shadow: 0 0 28px rgba(57, 255, 136, .55); }
.btn-blue { background: var(--blue-l); border-color: var(--blue); color: var(--blue-t); }
.btn-blue:hover { border-color: var(--blue); box-shadow: 0 0 0 1px rgba(77, 163, 255, .3), 0 0 20px rgba(77, 163, 255, .3); }
.btn-red { background: var(--red); border-color: var(--red); color: #2A0710; box-shadow: 0 0 18px rgba(255, 77, 109, .35); }
.btn-red:hover { border-color: var(--red); box-shadow: 0 0 26px rgba(255, 77, 109, .55); }
.btn-dark { background: #F0F6FC; border-color: #F0F6FC; color: #0D1117; }
.btn-dark:hover { box-shadow: 0 0 24px rgba(240, 246, 252, .35); border-color: #fff; }
.btn-red-outline { color: var(--red-t); border-color: var(--red); background: transparent; }
.btn-red-outline:hover { border-color: var(--red); box-shadow: 0 0 18px rgba(255, 77, 109, .3); }
.btn-lg { padding: .75em 1.6em; font-size: 1.05rem; min-height: 52px; }
.btn-sm { padding: .3em .8em; min-height: 34px; font-size: .85rem; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn { background: none; border: 0; font-size: 1.2rem; color: var(--muted); cursor: pointer; padding: 6px 10px; border-radius: 10px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.link-btn { background: none; border: 0; color: var(--neon); font-weight: 700; cursor: pointer; font-size: .82rem; font-family: var(--mono); }
.link-btn:hover { text-decoration: underline; }
.lang-btn {
  border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: 8px;
  font-family: var(--mono); font-weight: 700; font-size: .78rem; padding: 3px 8px; cursor: pointer; color: var(--text);
}
.lang-btn:hover { border-color: var(--neon); color: var(--neon); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.notice { background: var(--blue-l); color: var(--blue-t); border: 1px solid rgba(77, 163, 255, .3); border-radius: 12px; padding: 10px 14px; font-weight: 600; font-size: .9rem; margin: 10px 0; display: flex; gap: 8px; align-items: center; }
.notice-bad { background: var(--red-l); color: var(--red-t); border-color: rgba(255, 77, 109, .35); }
.tag { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: .8rem; font-family: var(--mono); }
.tag-blue { background: var(--blue-l); color: var(--blue-t); border: 1px solid rgba(77, 163, 255, .35); }
.tag-amber { background: var(--amber-l); color: var(--amber-t); border: 1px solid rgba(255, 194, 61, .35); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: .76rem; }
.pill-green { background: var(--neon-l); color: var(--neon); border: 1px solid rgba(57, 255, 136, .4); }
.pill-gray { background: var(--surface-3); color: var(--muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Khởi động & chuyển trang ============ */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-blob { width: 64px; height: 56px; background: var(--neon); border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%; animation: squish 1s ease-in-out infinite; box-shadow: 0 0 30px rgba(57, 255, 136, .6); }
@keyframes squish { 50% { transform: scale(1.15, .85); } }
.view { animation: viewIn .35s ease-out both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }

/* ============ Thanh trên ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 8px 20px; background: rgba(10, 14, 23, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 4px; color: var(--text); font-family: var(--mono); font-weight: 700; font-size: 1.02rem; }
.logo::before { content: '>'; color: var(--violet); margin-right: 2px; }
.logo b { color: var(--neon); text-shadow: 0 0 12px rgba(57, 255, 136, .6); }
.logo svg { margin: -8px 0 -6px; }
.nav { display: flex; gap: 4px; margin-left: 10px; }
.nav a { display: flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 10px; color: var(--muted); font-weight: 700; border: 1px solid transparent; transition: color .15s, border-color .15s, background .15s; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.on { color: var(--neon); background: var(--neon-l); border-color: rgba(57, 255, 136, .45); box-shadow: 0 0 16px rgba(57, 255, 136, .15); }
.stats { display: flex; align-items: center; gap: 14px; margin-left: auto; font-weight: 700; font-family: var(--mono); }
.stat { display: flex; align-items: center; gap: 4px; white-space: nowrap; position: relative; }
.stat-streak { filter: grayscale(1); opacity: .55; }
.stat-streak.lit { filter: none; opacity: 1; color: var(--amber); }
.stat-gems { color: var(--blue-t); }
.stat-hearts { color: var(--red-t); }
.sync { width: 8px; height: 8px; border-radius: 50%; background: var(--neon); box-shadow: 0 0 8px var(--neon); }
.sync-pending { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.sync-offline { background: var(--red); box-shadow: 0 0 8px var(--red); }
.avatar img { border-radius: 50%; display: block; border: 1px solid var(--border-strong); }

.view { max-width: 1120px; margin: 0 auto; padding: 24px 20px 80px; }

/* ============ Trang chủ ============ */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.path-col, .side-col { min-width: 0; }
.side-col { position: sticky; top: 76px; display: grid; gap: 14px; }
.course-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; }
.course-chip { display: flex; align-items: center; gap: 8px; padding: 7px 14px 7px 7px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; cursor: pointer; white-space: nowrap; }
.course-chip.on { border-color: var(--neon); background: var(--neon-l); color: var(--neon); box-shadow: 0 0 16px rgba(57, 255, 136, .15); }
.course-chip.soon { opacity: .5; }
.course-chip small { font-size: .68rem; background: var(--surface-3); color: var(--muted); padding: 1px 6px; border-radius: 6px; font-family: var(--mono); }
.course-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--c); color: #fff; display: grid; place-items: center; font-family: var(--mono); font-size: .7rem; font-weight: 700; text-shadow: 0 1px 1px rgba(0, 0, 0, .4); }

.topic { margin-bottom: 40px; }
.topic-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 14%, var(--surface)), var(--surface));
  color: var(--text); border: 1px solid color-mix(in srgb, var(--tc) 60%, transparent); border-radius: var(--radius); padding: 16px 20px;
  box-shadow: 0 0 26px color-mix(in srgb, var(--tc) 16%, transparent), inset 0 0 30px color-mix(in srgb, var(--tc) 6%, transparent);
}
.topic-head h2 { margin: 0; color: var(--tc); font-family: var(--mono); font-size: 1.15rem; }
.topic-head p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.topic-kicker { font-family: var(--mono); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.topic-count { font-family: var(--mono); color: var(--tc); border: 1px solid color-mix(in srgb, var(--tc) 50%, transparent); border-radius: 10px; padding: 5px 11px; font-weight: 700; }
.topic.locked .topic-head { filter: grayscale(.9); opacity: .55; box-shadow: none; }

.path { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 34px 0 0; }
.node-wrap { position: relative; display: flex; flex-direction: column; align-items: center; transform: translateX(calc(var(--off) * 56px)); animation: nodeIn .5s var(--ease-pop) both; animation-delay: calc(var(--i) * 45ms); }
@keyframes nodeIn { from { opacity: 0; transform: translateX(calc(var(--off) * 56px)) translateY(18px) scale(.4); } }
.node {
  width: 72px; height: 72px; border-radius: 22px; border: 0; cursor: pointer;
  display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; color: #04121A;
  background: var(--tc); box-shadow: 0 0 18px color-mix(in srgb, var(--tc) 55%, transparent), inset 0 -5px 0 rgba(0, 0, 0, .22);
  transition: transform .15s var(--ease-pop), box-shadow .2s;
}
.node:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 0 30px color-mix(in srgb, var(--tc) 75%, transparent), inset 0 -5px 0 rgba(0, 0, 0, .22); }
.node:active { transform: translateY(2px) scale(.94); }
.node.done { background: color-mix(in srgb, var(--tc) 22%, var(--surface-2)); color: var(--tc); border: 1px solid color-mix(in srgb, var(--tc) 60%, transparent); box-shadow: none; font-size: 1.4rem; }
.node.locked { background: var(--surface-2); color: var(--muted); box-shadow: none; border: 1px solid var(--border); font-size: 1.2rem; }
.node.locked:hover { transform: none; }
.node.current { animation: nodeGlow 1.8s ease-in-out infinite; }
@keyframes nodeGlow { 50% { box-shadow: 0 0 40px color-mix(in srgb, var(--tc) 95%, transparent), 0 0 0 8px color-mix(in srgb, var(--tc) 18%, transparent), inset 0 -5px 0 rgba(0, 0, 0, .22); } }
.node-quiz { width: 84px; height: 84px; border-radius: 26px; }
.node-quiz.done { color: var(--amber); border-color: rgba(255, 194, 61, .6); background: var(--amber-l); }
.node-label { font-weight: 600; font-size: .8rem; color: var(--muted); max-width: 160px; text-align: center; line-height: 1.25; margin: 10px 0 12px; }
.node-start {
  position: absolute; top: -34px; z-index: 2;
  background: var(--surface); border: 1px solid var(--tc); color: var(--tc); font-family: var(--mono); font-weight: 700; font-size: .75rem;
  padding: 3px 11px; border-radius: 8px; animation: bob 1.4s ease-in-out infinite; white-space: nowrap; box-shadow: 0 0 14px color-mix(in srgb, var(--tc) 40%, transparent);
}
@keyframes bob { 50% { transform: translateY(-4px); } }
.more-soon { text-align: center; color: var(--muted); font-weight: 600; padding: 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius); font-family: var(--mono); font-size: .88rem; }

.slime-card { text-align: center; }
.bubble { position: relative; background: var(--surface-2); color: var(--neon-t); border: 1px dashed var(--border-strong); border-radius: 12px; padding: 9px 13px; font-family: var(--mono); font-size: .84rem; font-weight: 500; min-height: 44px; }
.bubble::after { content: '▋'; animation: caret 1s steps(1) infinite; margin-left: 2px; color: var(--neon); }
.bubble.say { animation: say .4s var(--ease-pop); }
@keyframes say { from { transform: scale(.85); opacity: 0; } }
@keyframes caret { 50% { opacity: 0; } }
.slime-stage { margin-top: 6px; display: grid; place-items: center; }
.slime-stage svg, .live-slime svg { filter: drop-shadow(0 0 18px var(--slime-glow, rgba(57, 255, 136, .25))); overflow: visible; }
.slime-name { font-weight: 700; font-size: 1.08rem; margin: 0 0 10px; }
.xpbar { height: 12px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-bottom: 6px; }
.xpbar div { height: 100%; background: var(--neon); border-radius: 99px; transition: width .8s var(--ease-pop); position: relative; overflow: hidden; box-shadow: 0 0 12px var(--neon); }
.xpbar div::after, .bar-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%); transform: translateX(-100%); animation: shine 2.8s ease-in-out infinite; }
@keyframes shine { 60%, 100% { transform: translateX(100%); } }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 8px; }
.cal-day { aspect-ratio: 1; border-radius: 5px; background: var(--surface-3); }
.cal-day.on { background: var(--amber); box-shadow: 0 0 8px rgba(255, 194, 61, .5); }
.cal-day.frozen { background: #7FD3FF; }
.cal-day.today { outline: 1.5px solid var(--neon); outline-offset: 1px; }
.hearts { letter-spacing: 2px; white-space: nowrap; }
.heart { color: var(--red); text-shadow: 0 0 8px rgba(255, 77, 109, .6); }
.heart.empty { color: var(--border-strong); text-shadow: none; }
.hearts.big { font-size: 2rem; }

/* ============ Slime ============ */
.slime { display: inline-block; overflow: visible; }
.slime .sl-flicker { transform-box: fill-box; transform-origin: 50% 100%; animation: flicker .6s ease-in-out infinite alternate; }
.slime .sl-twinkle { transform-box: fill-box; transform-origin: center; animation: twinkle 1.6s ease-in-out infinite; }
.slime .sl-matrix text { animation: rain 2.4s linear infinite; }
.slime .sl-orbit { animation: orbit 8s linear infinite; }
@keyframes flicker { to { transform: scale(1.04, 1.12); } }
@keyframes twinkle { 50% { transform: scale(.5); opacity: .5; } }
@keyframes rain { from { transform: translateY(-20px); opacity: 0; } 30% { opacity: .9; } to { transform: translateY(60px); opacity: 0; } }
@keyframes orbit { to { stroke-dashoffset: -160; } }

/* ============ Code ============ */
.CodeMirror {
  height: auto; background: var(--code-bg); color: var(--code-text);
  font-family: var(--mono); font-size: 14.5px; line-height: 22px;
  border-radius: 12px; padding: 6px 0; border: 1px solid var(--border);
}
.CodeMirror-focused { border-color: rgba(57, 255, 136, .5); box-shadow: 0 0 0 1px rgba(57, 255, 136, .2), 0 0 18px rgba(57, 255, 136, .12); }
.CodeMirror-gutters { background: var(--code-bg); border-right: 0; }
.CodeMirror-linenumber { color: #3B4762; padding: 0 10px 0 6px; }
.CodeMirror-activeline-background { background: rgba(57, 255, 136, .04); }
.CodeMirror-cursor { border-left: 2px solid var(--neon); }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: #233351 !important; }
.CodeMirror-matchingbracket { color: var(--amber) !important; text-decoration: underline; }
:is(.CodeMirror, .code-block, .code-fill) .cm-keyword { color: #FF7AE0; }
:is(.CodeMirror, .code-block, .code-fill) .cm-builtin { color: #4DD8FF; }
:is(.CodeMirror, .code-block, .code-fill) .cm-string { color: #A5FF75; }
:is(.CodeMirror, .code-block, .code-fill) .cm-number { color: #FFC23D; }
:is(.CodeMirror, .code-block, .code-fill) .cm-comment { color: var(--code-muted); font-style: italic; }
:is(.CodeMirror, .code-block, .code-fill) .cm-def { color: #8DB8FF; }
:is(.CodeMirror, .code-block, .code-fill) .cm-operator { color: #7FE7FF; }
:is(.CodeMirror, .code-block, .code-fill) .cm-variable,
:is(.CodeMirror, .code-block, .code-fill) .cm-punctuation { color: var(--code-text); }
:is(.CodeMirror, .code-block, .code-fill) :is(.cm-variable-2, .cm-property) { color: #FFD77F; }
pre.code-block, .code-fill {
  background: var(--code-bg); color: var(--code-text); font-family: var(--mono); font-size: 14.5px;
  line-height: 1.6; padding: 14px 18px; border-radius: 12px; margin: 0 0 14px; overflow-x: auto; white-space: pre; border: 1px solid var(--border);
}
.editor-wrap { border-radius: 12px; }

.out {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; min-height: 48px;
  font-family: var(--mono); font-size: 14px; overflow-x: auto; color: var(--neon-t);
}
.out.is-empty { color: var(--muted); font-family: var(--font); font-size: .86rem; }
.out-text { margin: 0; white-space: pre-wrap; font-family: var(--mono); color: var(--code-text); }
.out-none { color: var(--muted); font-family: var(--font); font-size: .9rem; }
.err-box { background: var(--red-l); color: var(--red-t); border: 1px solid rgba(255, 77, 109, .35); border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-family: var(--font); font-size: .92rem; }
.err-box code { background: rgba(0, 0, 0, .3); color: #FFD0D8; }
.err-title { font-weight: 600; }
.err-raw { font-family: var(--mono); font-size: .78rem; opacity: .75; margin-top: 4px; }
.io-label { display: block; font-weight: 700; font-size: .82rem; margin: 10px 0 4px; font-family: var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
textarea.stdin, input, select {
  width: 100%; font: inherit; color: var(--text); background: var(--code-bg);
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 12px;
}
textarea.stdin { font-family: var(--mono); font-size: 14px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--neon); box-shadow: 0 0 0 1px rgba(57, 255, 136, .25); }

/* ============ Bài học ============ */
.lesson { max-width: 780px; margin: 0 auto; }
.back { display: inline-block; font-weight: 600; color: var(--muted); margin-bottom: 12px; font-family: var(--mono); font-size: .9rem; }
.back:hover { color: var(--neon); }
.lesson-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--tc); box-shadow: 0 1px 0 0 color-mix(in srgb, var(--tc) 30%, transparent), 0 12px 24px -18px var(--tc); padding-bottom: 12px; margin-bottom: 22px; }
.lesson-head .topic-kicker { color: var(--tc); }
.lesson-slime { flex: none; }
.prose { font-size: 1.04rem; margin-bottom: 14px; }
.prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: 4px; }
.prose table { border-collapse: collapse; margin: 8px 0 12px; font-size: .93rem; }
.prose th, .prose td { border: 1px solid var(--border-strong); padding: 6px 12px; text-align: left; }
.prose th { background: var(--surface-2); color: var(--neon-t); font-family: var(--mono); font-size: .85rem; }
.tip { display: flex; gap: 10px; background: var(--amber-l); color: var(--amber-t); border: 1px solid rgba(255, 194, 61, .3); border-radius: 12px; padding: 12px 16px; font-weight: 500; margin-bottom: 18px; }
.example { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 20px; }
.example-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; font-size: .84rem; color: var(--muted); margin-bottom: 8px; font-family: var(--mono); }
.example-head .links { display: flex; gap: 12px; }
.example-actions { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.example-note { margin-top: 10px; font-size: .9rem; color: var(--muted); }
.lesson-foot { display: flex; justify-content: flex-end; margin-top: 28px; }

/* ============ Làm bài ============ */
.view-play { max-width: none; padding: 0; }
.play { min-height: 100vh; display: flex; flex-direction: column; }
.play-top { display: flex; align-items: center; gap: 16px; padding: 16px 24px; max-width: 980px; width: 100%; margin: 0 auto; }
.bar { flex: 1; height: 12px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--neon); border-radius: 99px; transition: width .5s var(--ease-pop); position: relative; overflow: hidden; box-shadow: 0 0 14px var(--neon); }
.play-hearts { font-weight: 700; color: var(--red-t); min-width: 50px; text-align: right; font-family: var(--mono); position: relative; }
.play-main { flex: 1; max-width: 880px; width: 100%; margin: 0 auto; padding: 8px 24px 32px; }
.play-tag { margin-bottom: 10px; min-height: 4px; }
.ex { animation: exIn .35s ease-out both; }
@keyframes exIn { from { opacity: 0; transform: translateX(24px); } }
.ex-kind { font-family: var(--mono); font-weight: 700; font-size: .78rem; color: var(--violet-t); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 6px; }
.ex-prompt { font-size: 1.35rem; margin-bottom: 16px; font-weight: 600; }
.ex-prompt code { font-size: .85em; }
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 14px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px;
  padding: 12px 16px; font-weight: 600; font-size: 1rem; transition: border-color .15s, background .15s, transform .1s;
  animation: exIn .35s ease-out both; animation-delay: calc(var(--k, 0) * 50ms);
}
.choice:hover { border-color: var(--violet); background: var(--surface-2); }
.choice:active { transform: scale(.99); }
.choice.sel { border-color: var(--blue); background: var(--blue-l); color: var(--blue-t); box-shadow: 0 0 16px rgba(77, 163, 255, .2); }
.choice.right { border-color: var(--neon); background: var(--neon-l); color: var(--neon-t); box-shadow: 0 0 18px rgba(57, 255, 136, .25); animation: popOk .4s var(--ease-pop); }
.choice.wrong { border-color: var(--red); background: var(--red-l); color: var(--red-t); animation: shakeX .4s; }
.choice-key { flex: none; width: 26px; height: 26px; border-radius: 7px; border: 1px solid currentColor; display: grid; place-items: center; font-size: .76rem; opacity: .6; font-family: var(--mono); }
.choice-text.mono { font-size: .94rem; }
@keyframes popOk { 40% { transform: scale(1.03); } }
@keyframes shakeX { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.code-fill { white-space: pre-wrap; }
.blank {
  display: inline-block; width: auto; padding: 0 6px; margin: 0 2px; height: 1.7em;
  font-family: var(--mono); font-size: 14.5px; background: #101A2C; color: var(--amber);
  border: 1px dashed #4A5B7E; border-radius: 6px; text-align: center; vertical-align: baseline;
}
.blank:focus { border-style: solid; border-color: var(--amber); box-shadow: 0 0 10px rgba(255, 194, 61, .3); }
.blank.right { border: 1px solid var(--neon); color: var(--neon); }
.blank.wrong { border: 1px solid var(--red); color: var(--red-t); }
.order-answer { min-height: 70px; border: 1px dashed var(--border-strong); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; transition: border-color .2s, background .2s; }
.order-answer.empty { justify-content: center; align-items: center; }
.order-answer.right { border: 1px solid var(--neon); background: var(--neon-l); }
.order-answer.wrong { border: 1px solid var(--red); background: var(--red-l); animation: shakeX .4s; }
.order-pool { display: flex; flex-direction: column; gap: 8px; }
.line-chip { text-align: left; cursor: pointer; background: var(--code-bg); border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 12px; animation: exIn .3s ease-out both; }
.line-chip code { background: none; padding: 0; white-space: pre; font-size: .93rem; color: var(--code-text); }
.line-chip:hover { border-color: var(--neon); }
.io { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.io.no-input { grid-template-columns: 1fr; }
.hint-box { display: grid; gap: 10px; margin-top: 16px; }
.hint { background: var(--amber-l); color: var(--amber-t); border: 1px solid rgba(255, 194, 61, .3); border-radius: 12px; padding: 12px 16px; animation: exIn .3s ease-out both; }
.hint-title { font-weight: 700; margin-bottom: 4px; font-family: var(--mono); font-size: .85rem; }
.hint-solution { background: var(--violet-l); color: var(--violet-t); border-color: rgba(167, 139, 250, .35); }
.hint pre.code-block { margin: 8px 0; }

.play-foot { position: sticky; bottom: 0; border-top: 1px solid var(--border); background: rgba(15, 22, 36, .92); backdrop-filter: blur(10px); z-index: 5; transition: background .25s, border-color .25s; }
.foot-inner { max-width: 980px; margin: 0 auto; padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 84px; }
.foot-right { display: flex; gap: 10px; }
.play-foot.fb-ok { background: rgba(10, 40, 24, .95); border-top-color: var(--neon); box-shadow: 0 -10px 30px -10px rgba(57, 255, 136, .3); }
.play-foot.fb-bad { background: rgba(48, 12, 20, .95); border-top-color: var(--red); box-shadow: 0 -10px 30px -10px rgba(255, 77, 109, .3); }
.feedback { display: flex; align-items: center; gap: 16px; width: 100%; animation: fbIn .35s var(--ease-pop) both; }
@keyframes fbIn { from { transform: translateY(20px); opacity: 0; } }
.fb-slime { flex: none; width: 76px; display: grid; place-items: center; }
.fb-text { flex: 1; min-width: 0; }
.fb-title { font-weight: 700; font-size: 1.25rem; }
.fb-ok .fb-title { color: var(--neon); text-shadow: 0 0 14px rgba(57, 255, 136, .5); }
.fb-bad .fb-title { color: var(--red-t); }
.fb-heart { font-size: .8rem; background: var(--red-l); border: 1px solid var(--red); color: var(--red-t); padding: 1px 8px; border-radius: 99px; vertical-align: middle; font-family: var(--mono); }
.fb-reward { font-size: .8rem; background: var(--neon-l); border: 1px solid rgba(57, 255, 136, .5); color: var(--neon); padding: 1px 8px; border-radius: 99px; vertical-align: middle; font-family: var(--mono); margin-left: 4px; }
.fb-detail { font-weight: 600; margin-top: 2px; }
.fb-answer { font-family: var(--mono); background: var(--code-bg); border: 1px solid var(--border); padding: 6px 10px; border-radius: 8px; margin: 4px 0 0; white-space: pre-wrap; font-size: .88rem; }
.fb-explain { margin-top: 6px; font-size: .92rem; color: var(--text); opacity: .85; }
.fb-actions { flex: none; }
.diff { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 6px; }
.diff span { display: block; font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-family: var(--mono); }
.diff pre { margin: 2px 0 0; background: var(--code-bg); border: 1px solid var(--border); padding: 6px 10px; border-radius: 8px; font-family: var(--mono); font-size: .86rem; white-space: pre-wrap; max-height: 140px; overflow: auto; }

.summary { text-align: center; padding: 24px 0; animation: viewIn .4s ease-out both; }
.summary h1 { font-size: 2rem; margin-top: 6px; font-family: var(--mono); }
.summary .live-slime { display: grid; place-items: center; }
.sum-tiles, .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; max-width: 640px; margin: 22px auto 0; }
.tile { border-radius: 14px; padding: 12px; border: 1px solid; text-align: center; animation: tileIn .5s var(--ease-pop) both; animation-delay: calc(var(--k, 0) * 90ms + .15s); }
.tile span { display: block; font-weight: 600; font-size: .8rem; }
.tile b { font-size: 1.6rem; font-weight: 700; font-family: var(--mono); }
@keyframes tileIn { from { opacity: 0; transform: translateY(16px) scale(.85); } }
.tile-amber { background: var(--amber-l); border-color: rgba(255, 194, 61, .5); color: var(--amber-t); }
.tile-blue { background: var(--blue-l); border-color: rgba(77, 163, 255, .5); color: var(--blue-t); }
.tile-green { background: var(--neon-l); border-color: rgba(57, 255, 136, .5); color: var(--neon-t); }
.tile-red { background: var(--red-l); border-color: rgba(255, 77, 109, .5); color: var(--red-t); }
.tile-purple { background: var(--violet-l); border-color: rgba(167, 139, 250, .5); color: var(--violet-t); }
.tile-gray { background: var(--surface-2); border-color: var(--border-strong); color: var(--muted); }

/* ============ Tủ đồ ============ */
.shop-head { display: flex; align-items: center; gap: 24px; margin-bottom: 18px; }
.shop-preview { flex: none; width: 200px; display: grid; place-items: center; }
.gem-balance { font-size: 1.25rem; color: var(--blue-t); margin: 6px 0; font-family: var(--mono); }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; }
.tab { padding: 7px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; cursor: pointer; white-space: nowrap; color: var(--muted); }
.tab:hover { color: var(--text); }
.tab.on { border-color: var(--neon); background: var(--neon-l); color: var(--neon); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.shop-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; transition: border-color .15s, transform .15s var(--ease-pop), box-shadow .2s; animation: tileIn .4s var(--ease-pop) both; animation-delay: calc(var(--k, 0) * 35ms); }
.shop-card:hover { border-color: var(--violet); transform: translateY(-3px); }
.shop-card.worn { border-color: var(--neon); background: var(--neon-l); box-shadow: 0 0 18px rgba(57, 255, 136, .15); }
.shop-name { font-weight: 700; font-size: .9rem; }
.shop-card.power { cursor: default; }
.power-ic { font-size: 2.4rem; }

/* ============ IDE ============ */
.view-ide { max-width: none; padding: 0; }
.ide { display: grid; grid-template-columns: 230px minmax(0, 1fr); height: calc(100vh - 57px); }
.ide-side { border-right: 1px solid var(--border); background: rgba(15, 22, 36, .7); display: flex; flex-direction: column; min-height: 0; }
.ide-side-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 16px; font-family: var(--mono); font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.ide-files { list-style: none; margin: 0; padding: 0 8px; overflow-y: auto; flex: 1; }
.ide-file { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-family: var(--mono); font-size: .86rem; color: var(--muted); border: 1px solid transparent; }
.ide-file:hover { background: var(--surface-2); color: var(--text); }
.ide-file.on { background: var(--neon-l); color: var(--neon); border-color: rgba(57, 255, 136, .35); }
.ide-file .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ide-file .facts { display: none; gap: 2px; }
.ide-file:hover .facts, .ide-file.on .facts { display: flex; }
.ide-file .facts button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 3px; font-size: .8rem; }
.ide-file .facts button:hover { color: var(--text); }
.ide-templates { padding: 10px 12px 14px; border-top: 1px solid var(--border); }
.ide-templates select { font-size: .85rem; padding: 6px 8px; }
.ide-main { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; }
.ide-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ide-toolbar .fname-big { font-family: var(--mono); font-weight: 700; margin-right: auto; color: var(--text); display: flex; align-items: center; gap: 8px; }
.ide-status { font-family: var(--mono); font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ide-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.ide-status.ready .dot { background: var(--neon); box-shadow: 0 0 8px var(--neon); }
.ide-editor { min-height: 0; overflow: hidden; padding: 10px 14px 0; }
.ide-editor .CodeMirror { height: 100%; border-radius: 12px; }
.ide-bottom { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 12px; padding: 10px 14px 14px; height: 36vh; min-height: 200px; }
.ide-pane { display: flex; flex-direction: column; min-height: 0; }
.ide-pane .io-label { margin-top: 0; display: flex; justify-content: space-between; align-items: center; }
.ide-pane textarea.stdin { flex: 1; resize: none; }
.console { flex: 1; overflow: auto; background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; font-family: var(--mono); font-size: 14px; }
.console .run-line { color: var(--muted); font-size: .78rem; margin: 6px 0 4px; }
.console .run-line:first-child { margin-top: 0; }
.console .out-text { color: var(--code-text); }
.console .ok { color: var(--neon); }

/* ============ Hồ sơ ============ */
.profile { max-width: 840px; margin: 0 auto; display: grid; gap: 16px; }
.profile-head { display: flex; align-items: center; gap: 18px; }
.profile-head h1 { margin: 0; }
.profile-avatar { border-radius: 50%; border: 2px solid var(--neon); box-shadow: 0 0 16px rgba(57, 255, 136, .3); }
.profile-avatar.ph { width: 72px; height: 72px; display: grid; place-items: center; font-size: 2rem; background: var(--surface-2); }
.profile-slime { margin-left: auto; }
.profile .stat-grid { margin: 0; max-width: none; }
.ach-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ach { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; background: var(--surface-2); opacity: .55; border: 1px solid var(--border); }
.ach.got { opacity: 1; background: var(--neon-l); border-color: rgba(57, 255, 136, .4); }
.settings .setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.settings .setting label { font-weight: 700; }
.settings select, .settings .inline { max-width: 280px; }
.inline { display: flex; gap: 8px; }
.switch { width: 46px; height: 26px; appearance: none; background: var(--border-strong); border-radius: 99px; position: relative; cursor: pointer; padding: 0; border: 0; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease-pop); }
.switch:checked { background: var(--neon); box-shadow: 0 0 12px rgba(57, 255, 136, .5); }
.switch:checked::after { transform: translateX(20px); background: #04210F; }

/* ============ Đăng nhập & chào mừng ============ */
.login, .welcome { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; position: relative; }
.login-lang { position: absolute; top: 16px; right: 16px; }
.login-card, .welcome-card { max-width: 440px; width: 100%; text-align: center; background: rgba(15, 22, 36, .85); backdrop-filter: blur(10px); border: 1px solid var(--border-strong); border-radius: 22px; padding: 28px 26px; box-shadow: 0 0 60px rgba(57, 255, 136, .08); animation: viewIn .5s ease-out both; }
.login-slime { display: grid; place-items: center; }
.login-card h1 { font-size: 2rem; margin: 4px 0; font-family: var(--mono); }
.login-card h1 b { color: var(--neon); text-shadow: 0 0 16px rgba(57, 255, 136, .6); }
.login-tag { color: var(--muted); font-weight: 500; }
.login-points { list-style: none; padding: 0; margin: 18px 0 22px; text-align: left; display: grid; gap: 8px; font-weight: 500; font-size: .94rem; }
.login-points li { background: var(--surface-2); border: 1px solid var(--border); padding: 9px 13px; border-radius: 10px; animation: exIn .4s ease-out both; }
.login-points li:nth-child(2) { animation-delay: .08s; }
.login-points li:nth-child(3) { animation-delay: .16s; }
.login-points li:nth-child(4) { animation-delay: .24s; }
.login-card .btn + .btn { margin-top: 10px; }
.welcome-card { text-align: left; }
.welcome-card h1 { margin-top: 4px; }
.welcome-card .topic-kicker { color: var(--neon); }
.welcome-stage { display: grid; place-items: center; margin: 4px 0 10px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field-err { color: var(--red-t); font-size: .85rem; font-weight: 600; margin-top: 4px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: 12px; padding: 4px; cursor: pointer; line-height: 0; transition: transform .15s var(--ease-pop), border-color .15s; }
.swatch:hover { transform: translateY(-2px); }
.swatch.on { border-color: var(--neon); background: var(--neon-l); box-shadow: 0 0 12px rgba(57, 255, 136, .25); }

/* ============ Thông báo, pháo giấy, hiệu ứng ============ */
#toasts { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); padding: 10px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: toastIn .3s var(--ease-pop); transition: opacity .3s, transform .3s; text-align: center; }
.toast-ok { border-color: var(--neon); color: var(--neon-t); box-shadow: 0 0 20px rgba(57, 255, 136, .25), 0 10px 30px rgba(0, 0, 0, .45); }
.toast-bad { border-color: var(--red); color: var(--red-t); }
.toast.out { opacity: 0; transform: translateY(10px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.9); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 99; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 13px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 105vh) rotate(var(--rot)); } }
.float-fx { position: fixed; z-index: 98; font-family: var(--mono); font-weight: 700; pointer-events: none; animation: floatUp 1.1s ease-out forwards; white-space: nowrap; text-shadow: 0 0 10px currentColor; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.7); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -50px) scale(1); } }
.heart-shard { position: fixed; z-index: 98; pointer-events: none; animation: heartFall 1s ease-in forwards; }
@keyframes heartFall { to { transform: translate(var(--hx), 90px) rotate(var(--hr)); opacity: 0; } }
.bump { animation: bump .45s var(--ease-pop); }
@keyframes bump { 40% { transform: scale(1.35); } }
.shake { animation: shakeX .45s; }
.lvl-overlay { position: fixed; inset: 0; z-index: 97; display: grid; place-items: center; pointer-events: none; background: radial-gradient(circle, rgba(10, 14, 23, .2), rgba(10, 14, 23, .75)); animation: fadeOut 2.4s ease-in forwards; }
.lvl-box { text-align: center; position: relative; animation: lvlIn .7s var(--ease-pop) both; }
.lvl-rays { position: absolute; left: 50%; top: 50%; width: 460px; height: 460px; margin: -230px; border-radius: 50%; background: repeating-conic-gradient(rgba(57, 255, 136, .28) 0 10deg, transparent 10deg 20deg); animation: spin 6s linear infinite; mask: radial-gradient(circle, #000 25%, transparent 68%); -webkit-mask: radial-gradient(circle, #000 25%, transparent 68%); }
.lvl-title { position: relative; font-family: var(--mono); font-size: 2.2rem; font-weight: 700; padding: 14px 30px; border-radius: 16px; background: var(--neon); color: #04210F; box-shadow: 0 0 40px rgba(57, 255, 136, .7); }
.lvl-sub { position: relative; margin-top: 12px; font-weight: 700; font-size: 1.15rem; color: var(--neon-t); text-shadow: 0 0 12px rgba(57, 255, 136, .6); }
@keyframes lvlIn { from { transform: scale(.2) rotate(-10deg); opacity: 0; } }
@keyframes fadeOut { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

/* ============ Điện thoại ============ */
@media (max-width: 900px) {
  .home { grid-template-columns: minmax(0, 1fr); }
  .side-col { position: static; order: -1; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .ide { grid-template-columns: 1fr; height: auto; }
  .ide-side { border-right: 0; border-bottom: 1px solid var(--border); max-height: 200px; }
  .ide-editor { height: 50vh; }
  .ide-bottom { grid-template-columns: 1fr; height: auto; }
  .ide-pane textarea.stdin { min-height: 70px; }
  .console { min-height: 160px; }
}
@media (max-width: 640px) {
  .topbar { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .logo span { display: none; }
  .nav { margin-left: 0; order: 3; width: 100%; justify-content: space-around; }
  .nav a { padding: 6px 9px; }
  .nav-label { font-size: .85rem; }
  .stats { gap: 10px; font-size: .88rem; }
  .avatar { display: none; }
  .view { padding: 16px 16px 60px; }
  .node-wrap { transform: translateX(calc(var(--off) * 36px)); }
  @keyframes nodeIn { from { opacity: 0; transform: translateX(calc(var(--off) * 36px)) translateY(18px) scale(.4); } }
  .io { grid-template-columns: 1fr; }
  .play-top, .play-main, .foot-inner { padding-left: 16px; padding-right: 16px; }
  .ex-prompt { font-size: 1.15rem; }
  .feedback { flex-wrap: wrap; }
  .fb-slime { display: none; }
  .fb-actions, .fb-actions .btn { width: 100%; }
  .foot-inner { flex-wrap: wrap; }
  .foot-right { flex: 1; justify-content: flex-end; }
  .shop-head { flex-direction: column; text-align: center; }
  .profile-head { flex-wrap: wrap; }
  .profile-slime { display: none; }
  .settings .setting { flex-direction: column; align-items: stretch; }
  .settings select, .settings .inline { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Thẻ mở IDE ở trang chủ */
.ide-promo { display: block; color: var(--text); border-color: rgba(167, 139, 250, .45); background: linear-gradient(135deg, var(--violet-l), var(--surface)); transition: border-color .15s, transform .15s var(--ease-pop), box-shadow .2s; }
.ide-promo:hover { border-color: var(--violet); transform: translateY(-2px); box-shadow: 0 0 22px rgba(167, 139, 250, .25); }
.ide-promo b { color: var(--violet-t); }
@media (min-width: 641px) and (max-width: 1000px) {
  .nav-label { display: none; }
  .nav a { padding: 7px 10px; }
  .topbar { gap: 10px; }
}

/* Biểu đồ matplotlib trong kết quả chạy */
.out-img { display: block; max-width: 100%; height: auto; margin: 10px 0 4px; border-radius: 10px; border: 1px solid var(--border-strong); background: #fff; }
.console .run-line.lib { color: var(--blue-t); }

/* ============ Chế độ game (pygame) ============ */
.ide-editor.with-game { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 46%); gap: 12px; }
.game-wrap { order: 2; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.game-wrap[hidden] { display: none; }
.game-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-weight: 700; font-size: .85rem; color: var(--neon); }
.game-canvas { width: 100%; max-width: 640px; height: auto; aspect-ratio: auto; display: block; background: #000; border: 1px solid var(--neon); border-radius: 12px; box-shadow: 0 0 24px rgba(57, 255, 136, .2); outline: none; image-rendering: auto; }
.game-canvas:focus { box-shadow: 0 0 0 2px var(--neon), 0 0 30px rgba(57, 255, 136, .45); }
.example .game-box { margin: 10px 0; }
.example .game-box[hidden] { display: none; }
.example .game-box canvas { max-width: 480px; }
@media (max-width: 900px) {
  .ide-editor.with-game { grid-template-columns: 1fr; height: auto; }
  .ide-editor.with-game .CodeMirror { height: 40vh; }
  .game-wrap { order: -1; }
}
