/* =========================================================
   Python Lab 2.0 — design system
   Ý tưởng: vở ô li + mực tím + bút đỏ chấm điểm.
   Chế độ tối: bảng đen + phấn.
   ========================================================= */

:root {
  --paper: #F5F6FA;
  --paper-2: #FFFFFF;
  --paper-3: #EEF0F6;
  --grid: rgba(70, 92, 160, 0.075);
  --ink: #1A2035;
  --ink-2: #464F6E;
  --ink-3: #747C98;
  --line: #DFE3EE;
  --line-2: #C8CEDE;

  --tim: var(--brand, #5B3FD6);
  --tim-2: color-mix(in srgb, var(--brand, #5B3FD6) 85%, #000);
  --tim-soft: color-mix(in srgb, var(--brand, #5B3FD6) 11%, #fff);
  --tim-ink: #FFFFFF;

  --do: #D3263A;
  --do-soft: #FDECEE;
  --la: #138A5A;
  --la-soft: #E2F4EB;
  --cam: #B86E00;
  --cam-soft: #FFF3D9;
  --vang: #FFE45E;

  --code-bg: #FFFFFF;
  --code-gutter: #F3F4F9;
  --console-bg: #1B2034;
  --console-ink: #E6E9F5;

  --shadow-1: 0 1px 0 rgba(26, 32, 53, 0.04), 0 1px 2px rgba(26, 32, 53, 0.06);
  --shadow-2: 0 10px 30px -12px rgba(36, 30, 90, 0.25);
  --shadow-pop: 0 24px 60px -20px rgba(20, 16, 60, 0.45);

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;

  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --side-w: 248px;
  --top-h: 60px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14211E; --paper-2: #1A2B27; --paper-3: #20332E;
    --grid: rgba(225, 240, 232, 0.035);
    --ink: #E8F0EB; --ink-2: #B4C3BC; --ink-3: #82958D;
    --line: #2A3E39; --line-2: #36504A;
    --tim: color-mix(in srgb, var(--brand, #5B3FD6) 55%, #fff); --tim-2: color-mix(in srgb, var(--brand, #5B3FD6) 45%, #fff); --tim-soft: color-mix(in srgb, var(--brand, #5B3FD6) 22%, transparent); --tim-ink: #17122E;
    --do: #FF6F7D; --do-soft: rgba(255, 111, 125, 0.13);
    --la: #5AD49C; --la-soft: rgba(90, 212, 156, 0.13);
    --cam: #F2B451; --cam-soft: rgba(242, 180, 81, 0.13);
    --vang: #F3D54B;
    --code-bg: #101B18; --code-gutter: #142320;
    --console-bg: #0C1513; --console-ink: #DCE8E2;
    --shadow-1: 0 1px 0 rgba(0,0,0,.25);
    --shadow-2: 0 14px 34px -14px rgba(0,0,0,.6);
    --shadow-pop: 0 30px 70px -20px rgba(0,0,0,.75);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14211E; --paper-2: #1A2B27; --paper-3: #20332E;
  --grid: rgba(225, 240, 232, 0.035);
  --ink: #E8F0EB; --ink-2: #B4C3BC; --ink-3: #82958D;
  --line: #2A3E39; --line-2: #36504A;
  --tim: color-mix(in srgb, var(--brand, #5B3FD6) 55%, #fff); --tim-2: color-mix(in srgb, var(--brand, #5B3FD6) 45%, #fff); --tim-soft: color-mix(in srgb, var(--brand, #5B3FD6) 22%, transparent); --tim-ink: #17122E;
  --do: #FF6F7D; --do-soft: rgba(255, 111, 125, 0.13);
  --la: #5AD49C; --la-soft: rgba(90, 212, 156, 0.13);
  --cam: #F2B451; --cam-soft: rgba(242, 180, 81, 0.13);
  --vang: #F3D54B;
  --code-bg: #101B18; --code-gutter: #142320;
  --console-bg: #0C1513; --console-ink: #DCE8E2;
  --shadow-1: 0 1px 0 rgba(0,0,0,.25);
  --shadow-2: 0 14px 34px -14px rgba(0,0,0,.6);
  --shadow-pop: 0 30px 70px -20px rgba(0,0,0,.75);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 12px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--tim); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: clamp(26px, 3.2vw, 34px); font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: 21px; font-weight: 750; }
h3 { font-size: 16.5px; font-weight: 700; }
p { margin: 0; }
code, pre, kbd { font-family: var(--mono); }
:focus-visible { outline: 2.5px solid var(--tim); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--tim-soft); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 999; background: var(--tim); color: var(--tim-ink); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  --b-bg: var(--paper-2); --b-ink: var(--ink); --b-line: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 15px;
  border: 1px solid var(--b-line); border-radius: var(--r);
  background: var(--b-bg); color: var(--b-ink);
  font-weight: 600; font-size: 14.5px; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: .6; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary { --b-bg: var(--tim); --b-ink: var(--tim-ink); --b-line: var(--tim); box-shadow: 0 6px 16px -8px var(--tim); }
.btn-primary:hover { --b-bg: var(--tim-2); --b-line: var(--tim-2); }
.btn-run { --b-bg: var(--la); --b-ink: #fff; --b-line: var(--la); }
:root[data-theme="dark"] .btn-run { --b-ink: #0B1A14; }
.btn-run:hover { filter: brightness(1.06); border-color: var(--la); }
.btn-danger { --b-ink: var(--do); --b-line: color-mix(in srgb, var(--do) 45%, transparent); }
.btn-danger:hover { --b-bg: var(--do-soft); border-color: var(--do); }
.btn-ghost { --b-bg: transparent; --b-line: transparent; }
.btn-ghost:hover { --b-bg: var(--paper-3); border-color: transparent; }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 13.5px; border-radius: 8px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--paper-3); color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }
.spin { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
kbd {
  display: inline-block; padding: 1px 6px; font-size: 11.5px; line-height: 1.5;
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--paper-2); color: var(--ink-2);
}

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field small { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.input, .field input, .field select, .field textarea, .select {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--paper-2); color: var(--ink); font-weight: 500;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.field textarea.code { font-family: var(--mono); font-size: 13.5px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .select:focus {
  outline: none; border-color: var(--tim); box-shadow: 0 0 0 3px var(--tim-soft);
}
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }
.form-msg { min-height: 20px; font-size: 14px; font-weight: 500; }
.form-msg.err { color: var(--do); }
.form-msg.ok { color: var(--la); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--tim); }

/* ---------- Surfaces ---------- */
.sheet {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.sheet-pad { padding: 22px; }
@media (max-width: 640px) { .sheet-pad { padding: 16px; } }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.sec-head p { color: var(--ink-3); font-size: 14px; margin-top: 2px; }

/* Pills / tags */
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; min-height: 24px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--paper-3); color: var(--ink-2);
  border: 1px solid transparent; white-space: nowrap;
}
.tag-tim { background: var(--tim-soft); color: var(--tim); }
.tag-la { background: var(--la-soft); color: var(--la); }
.tag-do { background: var(--do-soft); color: var(--do); }
.tag-cam { background: var(--cam-soft); color: var(--cam); }
.tag-line { background: transparent; border-color: var(--line-2); }
.tag svg { width: 13px; height: 13px; }

/* Progress */
.bar { height: 8px; border-radius: 99px; background: var(--paper-3); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--tim); transition: width .8s cubic-bezier(.22,1,.36,1); }
.bar.la > i { background: var(--la); }
.bar.thin { height: 5px; }

/* ---------- The red-pen stamp (dấu điểm bút đỏ) ---------- */
.stamp {
  --s: 56px;
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--s); height: calc(var(--s) * .84);
  color: var(--do); font-weight: 800; font-size: calc(var(--s) * .36); line-height: 1;
  transform: rotate(-9deg);
  font-feature-settings: "tnum";
}
.stamp::before {
  content: ""; position: absolute; inset: 0;
  border: 2.5px solid currentColor; border-radius: 50%;
  border-top-left-radius: 46% 60%; border-bottom-right-radius: 58% 44%;
  opacity: .9;
}
.stamp::after {
  content: ""; position: absolute; inset: -3px 4px 4px -2px;
  border: 1.5px solid currentColor; border-radius: 50%; opacity: .35; transform: rotate(14deg);
}
.stamp small { display: block; font-size: .38em; font-weight: 700; opacity: .85; margin-top: 2px; text-align: center; }
.stamp.sm { --s: 40px; }
.stamp.lg { --s: 92px; }
.stamp.is-new { animation: stampIn .45s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes stampIn { from { transform: rotate(-30deg) scale(1.8); opacity: 0; } to { transform: rotate(-9deg) scale(1); opacity: 1; } }
.stamp-empty { color: var(--line-2); }

/* =========================================================
   LANDING
   ========================================================= */
.lp-top {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.lp-top.scrolled { border-bottom-color: var(--line); }
.lp-top-in { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; gap: 14px; }
.lp-hero > * { min-width: 0; }
.brand { white-space: nowrap; display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand, #5B3FD6); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 800; position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: -4px -5px; border: 2px solid var(--do); border-radius: 50%; transform: rotate(-12deg); opacity: .85; }
.lp-nav { display: flex; gap: 4px; margin-left: 18px; }
.lp-nav a { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: 14.5px; text-decoration: none; }
.lp-nav a:hover { background: var(--paper-3); color: var(--ink); }
.lp-top .spacer { flex: 1; }
@media (max-width: 860px) { .lp-nav { display: none; } }

.lp-wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.lp-hero { padding: 56px 0 40px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; align-items: center; }
.lp-hero h1 { font-size: clamp(34px, 4.6vw, 58px); line-height: 1.04; letter-spacing: -0.04em; font-weight: 800; }
.lp-hero h1 .ln { display: block; }
.lp-hero h1 .strike { position: relative; color: var(--ink-3); font-weight: 700; }
.lp-hero h1 .strike::after { content: ""; position: absolute; left: -2%; right: -2%; top: 54%; height: 4px; background: var(--do); border-radius: 3px; transform: rotate(-2.5deg); }
.lp-lead { margin-top: 20px; font-size: 18px; color: var(--ink-2); max-width: 34em; line-height: 1.6; }
.lp-cta { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }
.lp-proof { margin-top: 28px; display: flex; gap: 26px; flex-wrap: wrap; color: var(--ink-2); font-size: 14px; }
.lp-proof b { display: block; font-size: 24px; color: var(--ink); font-weight: 800; letter-spacing: -0.02em; font-feature-settings: "tnum"; }
@media (max-width: 960px) { .lp-hero { grid-template-columns: minmax(0, 1fr); padding-top: 32px; gap: 32px; } }

/* Hero "trang vở" editor */
.notebook {
  position: relative; background: var(--paper-2); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-pop); overflow: hidden;
}
.notebook-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notebook-head .file { font-family: var(--mono); font-size: 13px; color: var(--ink-2); font-weight: 500; }
.notebook-head .spacer { flex: 1; }
.notebook .CodeMirror { height: 230px; font-size: 15px; }
.notebook-ex { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; background: var(--paper-3); }
.notebook-ex span { font-size: 13px; color: var(--ink-3); margin-right: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper-2);
  font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.chip:hover { border-color: var(--tim); color: var(--tim); }
.chip.on { background: var(--tim); border-color: var(--tim); color: var(--tim-ink); }
.notebook-out { position: relative; background: var(--console-bg); color: var(--console-ink); padding: 14px 16px 16px; min-height: 108px; }
.notebook-out pre { margin: 0; font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.notebook-out .lbl { font-size: 12px; color: color-mix(in srgb, var(--console-ink) 55%, transparent); margin-bottom: 6px; font-weight: 600; }
.notebook-out .stamp { position: absolute; right: 18px; top: 14px; color: #FF6B7A; }

.lp-sec { padding: 72px 0; }
.lp-sec + .lp-sec { border-top: 1px solid var(--line); }
.lp-sec-head { max-width: 640px; margin-bottom: 36px; }
.lp-sec-head h2 { font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -0.03em; font-weight: 800; line-height: 1.12; }
.lp-sec-head p { margin-top: 12px; color: var(--ink-2); font-size: 17px; }

/* Steps: đây thực sự là một quy trình nên dùng số */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; counter-reset: s; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-2); overflow: hidden; }
.steps li { counter-increment: s; padding: 24px 22px 26px; border-right: 1px solid var(--line); position: relative; }
.steps li:last-child { border-right: 0; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--tim); color: var(--tim); font-weight: 800; margin-bottom: 14px; }
.steps li:last-child::before { border-color: var(--do); color: var(--do); }
.steps h3 { margin-bottom: 6px; }
.steps p { color: var(--ink-2); font-size: 14.5px; }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr 1fr; } .steps li:nth-child(2) { border-right: 0; } .steps li:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } .steps li { border-right: 0; border-bottom: 1px solid var(--line); } .steps li:last-child { border-bottom: 0; } }

/* Feature: chẩn đoán lỗi */
.feature { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.feature + .feature { margin-top: 64px; }
.feature h3 { font-size: 24px; letter-spacing: -0.02em; font-weight: 800; }
.feature p { margin-top: 10px; color: var(--ink-2); font-size: 16px; }
.feature ul { margin: 16px 0 0; padding: 0 0 0 20px; color: var(--ink-2); }
.feature li { margin: 4px 0; }
.feature.rev > :first-child { order: 2; }
@media (max-width: 900px) { .feature { grid-template-columns: 1fr; gap: 22px; } .feature.rev > :first-child { order: 0; } }
.mock { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-2); }
.mock-code { font-family: var(--mono); font-size: 13.5px; line-height: 1.75; background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 0; overflow: hidden; }
.mock-code div { padding: 0 14px 0 0; display: flex; white-space: pre; }
.mock-code div i { font-style: normal; width: 34px; text-align: right; padding-right: 12px; color: var(--ink-3); flex: none; }
.mock-code div.bad { background: var(--do-soft); }
.mock-code div.bad span { text-decoration: underline wavy var(--do); text-underline-offset: 4px; }
.mock-hint { margin-top: 12px; border-left: 3px solid var(--do); background: var(--do-soft); border-radius: 0 10px 10px 0; padding: 10px 14px; font-size: 14px; color: var(--ink); }
.mock-hint b { color: var(--do); }
.mock-hint .btn { margin-top: 8px; }

/* Nhóm học / chương */
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.group {
  --gc: var(--tim);
  display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 18px; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: var(--paper-2); cursor: pointer; color: inherit; text-decoration: none;
  border-top: 4px solid var(--gc);
}
.group:hover { border-color: var(--gc); }
.group .ico { font-size: 24px; line-height: 1; }
.group strong { font-size: 16.5px; margin-top: 6px; }
.group span { color: var(--ink-3); font-size: 14px; }
.group .meta { margin-top: auto; padding-top: 10px; color: var(--ink-2); font-size: 13px; font-weight: 600; }

.toc { columns: 3 280px; column-gap: 28px; margin: 0; padding: 0; list-style: none; }
.toc li { break-inside: avoid; display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.toc li b { color: var(--tim); font-weight: 700; min-width: 30px; font-feature-settings: "tnum"; }
.toc li span { flex: 1; color: var(--ink-2); }
.toc li em { font-style: normal; color: var(--ink-3); font-size: 13px; white-space: nowrap; }

.reviews { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.review { margin: 0; padding: 18px; border-radius: var(--r-lg); background: var(--paper-2); border: 1px solid var(--line); }
.review .st { color: var(--cam); letter-spacing: 2px; }
.review blockquote { margin: 8px 0 10px; color: var(--ink); }
.review figcaption { color: var(--ink-3); font-size: 14px; font-weight: 600; }

.faq { max-width: 760px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 16px 0; font-weight: 700; font-size: 16.5px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--tim); font-size: 22px; line-height: 1; font-weight: 500; }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 0 18px; color: var(--ink-2); max-width: 64ch; }

.lp-band { margin: 24px 0 72px; padding: 44px 40px; border-radius: 22px; background: var(--tim); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; position: relative; overflow: hidden; }
:root[data-theme="dark"] .lp-band { background: color-mix(in srgb, var(--brand, #5B3FD6) 68%, #000); }
.lp-band h2 { font-size: clamp(24px, 3vw, 34px); font-weight: 800; letter-spacing: -0.03em; max-width: 20ch; }
.lp-band p { margin-top: 8px; opacity: .85; }
.lp-band .btn { --b-bg: #fff; --b-ink: #2C1C86; --b-line: #fff; }
.lp-foot { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--ink-3); font-size: 14px; }
.lp-foot .lp-wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* =========================================================
   AUTH MODAL + MODAL SYSTEM
   ========================================================= */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal-bg { position: absolute; inset: 0; background: rgba(15, 14, 35, 0.48); backdrop-filter: blur(3px); animation: fade .18s ease both; }
.modal {
  position: relative; width: min(100%, 460px); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-pop);
  padding: 26px; animation: pop .22s cubic-bezier(.2,1,.3,1) both;
}
.modal.wide { width: min(100%, 860px); }
.modal h2 { font-size: 22px; }
.modal .lead { color: var(--ink-2); margin-top: 6px; }
.modal-x { position: absolute; top: 12px; right: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: var(--paper-3); margin-bottom: 20px; }
.seg button { border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 700; color: var(--ink-3); cursor: pointer; }
.seg button.on { background: var(--paper-2); color: var(--ink); box-shadow: var(--shadow-1); }
.auth-form { display: grid; gap: 14px; margin-top: 18px; }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 64px; }
.pass-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--tim); font-weight: 700; font-size: 13px; padding: 6px 8px; cursor: pointer; }

/* Toasts */
.toasts { position: fixed; z-index: 200; right: 16px; bottom: 16px; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--ink); color: var(--paper-2); box-shadow: var(--shadow-pop); font-size: 14.5px; font-weight: 500;
  animation: pop .22s cubic-bezier(.2,1,.3,1) both;
}
:root[data-theme="dark"] .toast { background: #E8F0EB; color: #14211E; }
.toast i { font-style: normal; flex: none; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; font-size: 12px; font-weight: 800; color: #fff; background: var(--tim); }
.toast.ok i { background: var(--la); }
.toast.err i { background: var(--do); }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }

/* =========================================================
   APP SHELL
   ========================================================= */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--line); background: var(--paper-2);
  display: flex; flex-direction: column; padding: 16px 12px;
}
.side .brand { padding: 4px 10px 18px; }
.nav { display: grid; gap: 2px; }
.nav-sep { margin: 14px 10px 6px; font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px;
  color: var(--ink-2); font-weight: 600; font-size: 14.5px; text-decoration: none; position: relative;
}
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav a:hover { background: var(--paper-3); color: var(--ink); }
.nav a.on { background: var(--tim-soft); color: var(--tim); }
.nav a.on svg { opacity: 1; }
.nav a .count { margin-left: auto; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.side-foot { margin-top: auto; padding-top: 16px; display: grid; gap: 10px; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; background: var(--tim); flex: none; }
.me-card .who { min-width: 0; flex: 1; }
.me-card .who b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-card .who span { display: block; font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp-line { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; }
.xp-line b { color: var(--ink); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 10px; padding: 0 24px;
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.topbar .crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; color: var(--ink-3); font-weight: 600; overflow: hidden; }
.topbar .crumbs a { color: var(--ink-3); text-decoration: none; white-space: nowrap; }
.topbar .crumbs a:hover { color: var(--tim); }
.topbar .crumbs .cur { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumbs .sep { opacity: .5; }
.topbar .spacer { flex: 1; }
.search-btn {
  display: inline-flex; align-items: center; gap: 10px; min-width: 240px; height: 38px; padding: 0 10px 0 12px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--paper-2); color: var(--ink-3); font-size: 14px; cursor: pointer;
}
.search-btn svg { width: 16px; height: 16px; }
.search-btn kbd { margin-left: auto; }
.search-btn:hover { border-color: var(--tim); }
.menu-btn { display: none; }
.page { padding: 28px 28px 64px; max-width: 1240px; width: 100%; margin: 0 auto; }
.page.full { max-width: none; padding: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); margin-top: 6px; max-width: 64ch; }

@media (max-width: 1020px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 90; left: 0; top: 0; width: 280px; transform: translateX(-102%); transition: transform .25s cubic-bezier(.2,1,.3,1); box-shadow: var(--shadow-pop); }
  body.nav-open .side { transform: none; }
  body.nav-open .side-scrim { display: block; }
  .menu-btn { display: inline-grid; }
  .search-btn { min-width: 0; }
  .search-btn .lbl, .search-btn kbd { display: none; }
  .topbar { padding: 0 12px; }
  .page { padding: 20px 16px 56px; }
}
.side-scrim { display: none; position: fixed; inset: 0; z-index: 80; background: rgba(15,14,35,.4); }

/* ---------- Dashboard ---------- */
.dash-hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .dash-hero { grid-template-columns: 1fr; } }
.continue {
  position: relative; padding: 26px; border-radius: var(--r-lg); overflow: hidden;
  background: var(--tim); color: #fff; box-shadow: 0 18px 40px -22px var(--tim);
}
:root[data-theme="dark"] .continue { background: color-mix(in srgb, var(--brand, #5B3FD6) 68%, #000); }
.continue .hello { opacity: .82; font-weight: 500; }
.continue h1 { margin-top: 6px; color: #fff; }
.continue .next { margin-top: 18px; padding: 14px 16px; border-radius: 12px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); }
.continue .next small { opacity: .8; font-size: 13px; }
.continue .next b { display: block; font-size: 17px; margin-top: 2px; }
.continue .actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.continue .btn-primary { --b-bg: #fff; --b-ink: #2C1C86; --b-line: #fff; box-shadow: none; }
.continue .btn-ghost { --b-ink: #fff; }
.continue .btn-ghost:hover { --b-bg: rgba(255,255,255,.14); }
.ring-card { display: flex; gap: 20px; align-items: center; padding: 22px; }
.ring { --p: 0; --c: var(--tim); width: 128px; height: 128px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--paper-3) 0); }
.ring > div { width: 100px; height: 100px; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; text-align: center; }
.ring b { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; display: block; line-height: 1; }
.ring span { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.ring-card dl { margin: 0; display: grid; gap: 10px; flex: 1; }
.ring-card dl div { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.ring-card dt { color: var(--ink-3); font-weight: 500; }
.ring-card dd { margin: 0; font-weight: 700; font-feature-settings: "tnum"; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-2); overflow: hidden; margin-bottom: 16px; }
.stats > div { padding: 16px 18px; border-right: 1px solid var(--line); }
.stats > div:last-child { border-right: 0; }
.stats b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; font-feature-settings: "tnum"; line-height: 1.2; }
.stats span { color: var(--ink-3); font-size: 13.5px; font-weight: 600; }
@media (max-width: 720px) { .stats { grid-template-columns: 1fr 1fr; } .stats > div:nth-child(2) { border-right: 0; } .stats > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }

.two-col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 16px; }

.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat i { width: 12px; height: 12px; border-radius: 3px; background: var(--paper-3); }
.heat i[data-l="1"] { background: color-mix(in srgb, var(--tim) 30%, var(--paper-3)); }
.heat i[data-l="2"] { background: color-mix(in srgb, var(--tim) 55%, var(--paper-3)); }
.heat i[data-l="3"] { background: color-mix(in srgb, var(--tim) 80%, var(--paper-3)); }
.heat i[data-l="4"] { background: var(--tim); }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); margin-top: 8px; justify-content: flex-end; }
.heat-legend i { width: 10px; height: 10px; border-radius: 2px; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; color: inherit; text-decoration: none; min-width: 0; }
a.list-row:hover { background: var(--paper); border-radius: 10px; }
.list-row .t { flex: 1; min-width: 0; }
.list-row .t b { display: block; font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .t span { font-size: 13px; color: var(--ink-3); }
.ico-box { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: var(--paper-3); flex: none; }

.path-row { --gc: var(--tim); }
.path-row .ico-box { background: color-mix(in srgb, var(--gc) 14%, transparent); }
.path-row .bar > i { background: var(--gc); }

.empty { text-align: center; padding: 36px 16px; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* ---------- Catalog ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a {
  border: 0; background: transparent; padding: 10px 14px; font-weight: 650; font-size: 14.5px; color: var(--ink-3);
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.tabs button:hover, .tabs a:hover { color: var(--ink); }
.tabs .on { color: var(--tim); border-bottom-color: var(--tim); }
.tabs .n { font-size: 12px; margin-left: 4px; color: var(--ink-3); font-weight: 600; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input { max-width: 320px; min-height: 38px; }
.toolbar .select { width: auto; min-height: 38px; }

.chapters { display: grid; gap: 10px; }
.chapter-row {
  display: grid; grid-template-columns: 54px minmax(0, 1fr) 200px auto; gap: 16px; align-items: center;
  padding: 14px 16px; border-radius: var(--r-lg); background: var(--paper-2); border: 1px solid var(--line);
  color: inherit; text-decoration: none;
}
.chapter-row:hover { border-color: var(--tim); }
.chapter-row .num { font-size: 22px; font-weight: 800; color: var(--tim); text-align: center; letter-spacing: -0.03em; font-feature-settings: "tnum"; }
.chapter-row.is-done .num { color: var(--la); }
.chapter-row .t b { display: block; font-size: 15.5px; }
.chapter-row .t span { font-size: 13px; color: var(--ink-3); }
.chapter-row .p { display: grid; gap: 5px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
@media (max-width: 760px) { .chapter-row { grid-template-columns: 40px minmax(0, 1fr); } .chapter-row .p { grid-column: 2; } .chapter-row > :last-child { display: none; } }

/* ---------- Chapter page ---------- */
.ch-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: end; margin-bottom: 22px; }
.ch-head .kicker { color: var(--tim); font-weight: 700; font-size: 14px; }
.ch-head h1 { margin-top: 4px; }
.ch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1060px) { .ch-layout { grid-template-columns: 1fr; } }
.theory { font-size: 15.5px; color: var(--ink); line-height: 1.75; max-width: 70ch; }
.code-view {
  margin: 14px 0 0; padding: 14px 16px; border-radius: 12px; background: var(--code-bg); border: 1px solid var(--line);
  font-size: 13.8px; line-height: 1.65; overflow-x: auto; white-space: pre; color: var(--ink);
}
.ex-list { list-style: none; margin: 0; padding: 0; }
.ex-item { border-bottom: 1px solid var(--line); }
.ex-item:last-child { border-bottom: 0; }
.ex-item a, .ex-item > div { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 6px; text-decoration: none; color: inherit; border-radius: 10px; }
.ex-item a:hover { background: var(--paper); }
.ex-item .st { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-2); color: var(--ink-3); font-size: 12px; font-weight: 800; }
.ex-item.done .st { border-color: var(--la); background: var(--la); color: #fff; }
.ex-item.next .st { border-color: var(--tim); color: var(--tim); }
.ex-item.locked { opacity: .55; }
.ex-item .t b { font-weight: 650; font-size: 14.5px; display: block; }
.ex-item .t span { font-size: 12.5px; color: var(--ink-3); }
.ex-item svg { width: 16px; height: 16px; }

.exam-card { border: 2px dashed color-mix(in srgb, var(--do) 45%, var(--line)); }
.exam-card h3 { display: flex; align-items: center; gap: 8px; }
.exam-meta { margin: 12px 0 16px; display: grid; gap: 8px; font-size: 14px; }
.exam-meta div { display: flex; justify-content: space-between; gap: 10px; }
.exam-meta dt { color: var(--ink-3); }
.exam-meta dd { margin: 0; font-weight: 650; text-align: right; }

/* =========================================================
   EXERCISE WORKSPACE
   ========================================================= */
.ws { display: grid; grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.18fr); height: calc(100vh - var(--top-h)); min-height: 560px; }
.ws-left, .ws-right, .pg-main { min-width: 0; }
.ws-left { border-right: 1px solid var(--line); background: var(--paper-2); display: flex; flex-direction: column; min-height: 0; }
.ws-left .tabs { margin: 0; padding: 0 14px; }
.ws-scroll { flex: 1; overflow-y: auto; padding: 20px 22px 28px; }
.ws-title { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; }
.ws-title .kicker { font-size: 13px; color: var(--tim); font-weight: 700; text-decoration: none; }
.ws-title h1 { font-size: 23px; margin-top: 4px; }
.prompt { margin-top: 16px; font-size: 15.5px; line-height: 1.75; color: var(--ink); }
.prompt code, .ic { font-family: var(--mono); font-size: .88em; background: var(--tim-soft); color: var(--tim); padding: 1px 6px; border-radius: 5px; }
.req { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); font-size: 14px; }
.req b { display: block; margin-bottom: 8px; font-size: 13.5px; color: var(--ink-2); }
.req .row { gap: 6px; }
.rules { margin-top: 16px; font-size: 13.5px; color: var(--ink-3); line-height: 1.65; }
.ws-nav { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: center; }
.ws-nav .spacer { flex: 1; }

.ws-right { display: flex; flex-direction: column; min-height: 0; background: var(--code-bg); }
.ed-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--paper-2); flex-wrap: wrap; }
.ed-bar .file { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; gap: 8px; }
.ed-bar .file .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--la); }
.ed-bar .file .dot.dirty { background: var(--cam); }
.ed-bar .spacer { flex: 1; }
.ed-main { flex: 1; min-height: 0; position: relative; }
.ed-main .CodeMirror { position: absolute; inset: 0; height: auto; }
.quick { display: flex; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--code-gutter); overflow-x: auto; scrollbar-width: thin; }
.quick button { flex: none; font-family: var(--mono); font-size: 12.5px; padding: 4px 9px; border-radius: 6px; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink-2); cursor: pointer; }
.quick button:hover { border-color: var(--tim); color: var(--tim); }

.console { height: 38%; min-height: 160px; display: flex; flex-direction: column; background: var(--console-bg); color: var(--console-ink); border-top: 1px solid var(--line); }
.console-tabs { display: flex; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid rgba(255,255,255,.08); }
.console-tabs button { border: 0; background: transparent; color: rgba(230,233,245,.55); padding: 9px 12px; font-weight: 650; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.console-tabs button.on { color: #fff; border-bottom-color: #A794FF; }
.console-tabs .badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 99px; background: #FF6B7A; color: #fff; font-size: 11px; }
.console-tabs .spacer { flex: 1; }
.console-body { flex: 1; overflow: auto; padding: 12px 16px 16px; font-size: 14px; }
.console-body pre { margin: 0; font-family: var(--mono); font-size: 13.8px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.console-body .ph { color: rgba(230,233,245,.45); font-size: 13.5px; }
.console-tabs kbd, .console-body .ph kbd { background: transparent; color: rgba(230,233,245,.7); border-color: rgba(255,255,255,.2); }

.verdict { display: flex; gap: 16px; align-items: center; padding: 6px 0 12px; }
.verdict .stamp { color: #FF6B7A; }
.verdict.ok .stamp { color: #FF6B7A; }
.verdict h3 { color: #fff; font-size: 17px; }
.verdict p { color: rgba(230,233,245,.7); font-size: 13.5px; margin-top: 2px; }
.diag { border-left: 3px solid #FF6B7A; background: rgba(255,107,122,.09); border-radius: 0 10px 10px 0; padding: 10px 14px; margin: 8px 0; }
.diag b { color: #FFB3BB; font-size: 13px; }
.diag .msg { margin-top: 2px; color: #fff; }
.diag .fix { margin-top: 6px; color: rgba(230,233,245,.78); font-size: 13.5px; }
.diag .fix::before { content: "Cách sửa: "; color: #9FE5C3; font-weight: 700; }
.diag .btn { margin-top: 8px; --b-bg: rgba(255,255,255,.06); --b-ink: #fff; --b-line: rgba(255,255,255,.2); }
.diag.warn { border-left-color: #F2B451; background: rgba(242,180,81,.08); }
.diag.warn b { color: #F7D08A; }
.out-cmp { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 8px; }
.out-cmp .lbl { font-size: 12px; color: rgba(230,233,245,.5); font-weight: 600; margin-bottom: 4px; }
.out-cmp pre { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; padding: 8px 10px; }

.hist { display: grid; gap: 8px; }
.hist-item { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.hist-item summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; font-size: 14px; }
.hist-item summary::-webkit-details-marker { display: none; }
.hist-item summary .spacer { flex: 1; }
.hist-item pre { margin: 0; padding: 12px 14px; background: var(--code-bg); border-top: 1px solid var(--line); font-size: 13px; overflow-x: auto; }
.hist-item .row { padding: 8px 12px; border-top: 1px solid var(--line); }

@media (max-width: 960px) {
  .ws { grid-template-columns: minmax(0, 1fr); height: auto; }
  .ws-left, .ws-right, .pg-main { min-width: 0; }
.ws-left { border-right: 0; border-bottom: 1px solid var(--line); }
  .ws-scroll { max-height: none; }
  .ed-main { height: 340px; flex: none; }
  .console { height: auto; min-height: 220px; }
}

/* ---------- CodeMirror theme: "vở" / "bảng đen" ---------- */
.CodeMirror { font-family: var(--mono); font-size: 14.5px; line-height: 1.65; background: var(--code-bg); color: var(--ink); height: 100%; }
.CodeMirror-gutters { background: var(--code-gutter); border-right: 1px solid var(--line); }
.CodeMirror-linenumber { color: var(--ink-3); padding: 0 10px 0 6px; font-size: 12.5px; }
.CodeMirror-cursor { border-left: 2px solid var(--tim); }
.CodeMirror-selected { background: var(--tim-soft) !important; }
.CodeMirror-focused .CodeMirror-selected { background: color-mix(in srgb, var(--tim) 22%, transparent) !important; }
.CodeMirror-activeline-background { background: color-mix(in srgb, var(--tim) 5%, transparent); }
.CodeMirror-matchingbracket { color: var(--la) !important; background: var(--la-soft); outline: none; }
.CodeMirror-lines { padding: 10px 0; }
.cm-s-pl .cm-keyword { color: #7A2FD0; font-weight: 600; }
.cm-s-pl .cm-builtin { color: #0B6FB8; }
.cm-s-pl .cm-string { color: #0F7A46; }
.cm-s-pl .cm-number { color: #B5530A; }
.cm-s-pl .cm-comment { color: #8A90A8; font-style: italic; }
.cm-s-pl .cm-def { color: #B01C5B; font-weight: 600; }
.cm-s-pl .cm-operator { color: #4B5470; }
.cm-s-pl .cm-variable-2 { color: #1F5BAE; }
.cm-s-pl .cm-atom { color: #B5530A; }
:root[data-theme="dark"] .cm-s-pl .cm-keyword { color: #C3B5FF; }
:root[data-theme="dark"] .cm-s-pl .cm-builtin { color: #7CC7F5; }
:root[data-theme="dark"] .cm-s-pl .cm-string { color: #9FE5A6; }
:root[data-theme="dark"] .cm-s-pl .cm-number, :root[data-theme="dark"] .cm-s-pl .cm-atom { color: #F7C873; }
:root[data-theme="dark"] .cm-s-pl .cm-comment { color: #6E877E; }
:root[data-theme="dark"] .cm-s-pl .cm-def { color: #FF9EC3; }
:root[data-theme="dark"] .cm-s-pl .cm-operator { color: #A8BDB4; }
:root[data-theme="dark"] .cm-s-pl .cm-variable-2 { color: #9CC4FF; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cm-s-pl .cm-keyword { color: #C3B5FF; }
  :root:not([data-theme="light"]) .cm-s-pl .cm-builtin { color: #7CC7F5; }
  :root:not([data-theme="light"]) .cm-s-pl .cm-string { color: #9FE5A6; }
  :root:not([data-theme="light"]) .cm-s-pl .cm-number, :root:not([data-theme="light"]) .cm-s-pl .cm-atom { color: #F7C873; }
  :root:not([data-theme="light"]) .cm-s-pl .cm-comment { color: #6E877E; }
  :root:not([data-theme="light"]) .cm-s-pl .cm-def { color: #FF9EC3; }
  :root:not([data-theme="light"]) .cm-s-pl .cm-variable-2 { color: #9CC4FF; }
}
.cm-lint-bg { background: var(--do-soft); }
.cm-lint-wave { text-decoration: underline wavy var(--do); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.cm-err-line { background: color-mix(in srgb, var(--do) 14%, transparent); }
.lint-gutter { width: 14px; }
.lint-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--do); margin: 8px 0 0 3px; }
.CodeMirror-hints { font-family: var(--font); font-size: 13.5px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper-2); box-shadow: var(--shadow-2); padding: 4px; z-index: 300; }
.CodeMirror-hint { color: var(--ink); padding: 5px 10px; border-radius: 6px; }
li.CodeMirror-hint-active { background: var(--tim); color: var(--tim-ink); }

/* ---------- Mini editor (thi, sân chơi trong trang) ---------- */
.ed-box { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--code-bg); }
.ed-box .CodeMirror { height: 260px; }
.ed-box .console { height: auto; min-height: 110px; border-radius: 0; }

/* Playground */
.pg { display: grid; grid-template-columns: minmax(0, 1fr) 300px; height: calc(100vh - var(--top-h)); min-height: 520px; }
.pg-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pg-side { border-left: 1px solid var(--line); background: var(--paper-2); overflow-y: auto; padding: 18px; }
.pg-side h3 { font-size: 14.5px; margin: 4px 0 10px; }
.snip { display: grid; gap: 6px; }
.snip button { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; }
.snip button:hover { border-color: var(--tim); }
.snip button b { display: block; font-size: 14px; }
.snip button span { font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 960px) { .pg { grid-template-columns: minmax(0, 1fr); height: auto; } .pg .ed-main { height: 380px; flex: none; } .pg-side { border-left: 0; border-top: 1px solid var(--line); } }

/* ---------- Exam ---------- */
.exam-bar {
  position: sticky; top: var(--top-h); z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; margin-bottom: 18px; border-radius: 14px; background: var(--paper-2); border: 1px solid var(--line); box-shadow: var(--shadow-2);
}
.timer { font-family: var(--mono); font-size: 22px; font-weight: 700; font-feature-settings: "tnum"; color: var(--ink); }
.timer.warn { color: var(--cam); }
.timer.crit { color: var(--do); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }
.exam-bar .bar { flex: 1; }
.q { padding: 20px 22px; }
.q + .q { border-top: 1px solid var(--line); }
.q h3 { font-size: 16px; display: flex; gap: 10px; }
.q h3 em { font-style: normal; color: var(--tim); flex: none; }
.opts { display: grid; gap: 8px; margin-top: 12px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 11px; border: 1.5px solid var(--line); cursor: pointer; font-weight: 500; }
.opt:hover { border-color: var(--line-2); background: var(--paper); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .k { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-2); font-size: 13px; font-weight: 700; flex: none; color: var(--ink-3); }
.opt:has(input:checked) { border-color: var(--tim); background: var(--tim-soft); }
.opt:has(input:checked) .k { background: var(--tim); border-color: var(--tim); color: var(--tim-ink); }
.opt:has(input:focus-visible) { outline: 2.5px solid var(--tim); outline-offset: 2px; }
.result-card { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.result-card dl { margin: 0; display: grid; grid-template-columns: auto auto; gap: 6px 18px; font-size: 14.5px; }
.result-card dt { color: var(--ink-3); }
.result-card dd { margin: 0; font-weight: 700; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-2); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 650; color: var(--ink-3); font-size: 13px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--paper); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--paper) 70%, transparent); }
td.num, th.num { text-align: right; font-feature-settings: "tnum"; }
tr.me td { background: var(--tim-soft) !important; }
td input[type="datetime-local"], td input[type="number"] { min-height: 34px; padding: 4px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--paper-2); }

/* Leaderboard podium */
.podium { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 12px; align-items: end; margin-bottom: 18px; }
.pod { text-align: center; padding: 18px 12px 16px; border-radius: var(--r-lg); background: var(--paper-2); border: 1px solid var(--line); }
.pod .avatar { margin: 0 auto 8px; width: 48px; height: 48px; font-size: 18px; }
.pod b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .xp { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; }
.pod .rank { font-size: 13px; color: var(--ink-3); font-weight: 700; }
.pod.p1 { padding-top: 28px; border: 2px solid var(--vang); background: color-mix(in srgb, var(--vang) 10%, var(--paper-2)); }
.pod.p1 .avatar { width: 60px; height: 60px; font-size: 22px; }
@media (max-width: 600px) { .podium { grid-template-columns: 1fr; } }

/* ---------- Certificate ---------- */
.cert {
  position: relative; max-width: 880px; margin: 0 auto; padding: 56px 56px 48px; text-align: center;
  background: #FFFDF8; color: #1A2035; border-radius: 6px;
  box-shadow: var(--shadow-pop);
  border: 1px solid #E8E1CF;
  outline: 10px solid #FFFDF8; outline-offset: 0;
  background-image: linear-gradient(rgba(70,92,160,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(70,92,160,.06) 1px, transparent 1px);
  background-size: 24px 24px;
}
.cert::before { content: ""; position: absolute; inset: 14px; border: 2px solid var(--brand, #5B3FD6); border-radius: 4px; pointer-events: none; }
.cert::after { content: ""; position: absolute; inset: 20px; border: 1px solid rgba(91,63,214,.35); border-radius: 2px; pointer-events: none; }
.cert .org { font-weight: 800; color: var(--brand, #5B3FD6); font-size: 16px; }
.cert h1 { font-size: clamp(30px, 5vw, 46px); margin-top: 18px; letter-spacing: -0.03em; color: #1A2035; }
.cert .to { margin-top: 18px; color: #4A5270; }
.cert .name { font-size: clamp(28px, 4.6vw, 44px); font-weight: 800; margin-top: 6px; color: #3B23B0; font-style: italic; letter-spacing: -0.02em; }
.cert .what { margin: 14px auto 0; max-width: 46ch; color: #3E4663; }
.cert .sig { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 40px; gap: 20px; text-align: left; font-size: 13.5px; color: #4A5270; }
.cert .sig b { display: block; color: #1A2035; font-size: 15px; }
.cert .stamp { color: #D3263A; --s: 104px; }
.cert-locked { filter: grayscale(.6); opacity: .55; }

/* ---------- Admin ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; border-radius: var(--r-lg); background: var(--paper-2); border: 1px solid var(--line); }
.kpi b { display: block; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; font-feature-settings: "tnum"; }
.kpi span { color: var(--ink-3); font-size: 13.5px; font-weight: 600; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tpl { text-align: left; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; }
.tpl:hover, .tpl.on { border-color: var(--tim); background: var(--tim-soft); }
.tpl b { display: block; font-size: 13.5px; }
.tpl span { font-size: 12px; color: var(--ink-3); }
.code-pre { margin: 0; padding: 10px 12px; background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; overflow-x: auto; white-space: pre; max-height: 360px; }
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 8px; }
.bar-chart div { flex: 1; background: var(--tim); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; opacity: .85; }
.bar-chart div:hover { opacity: 1; }
.bar-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }

/* ---------- Command palette ---------- */
.palette { width: min(100%, 620px); padding: 0; align-self: start; margin-top: 10vh; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 18px 20px; font-size: 17px; outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 56vh; overflow-y: auto; }
.palette li a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; color: inherit; text-decoration: none; }
.palette li a .t { flex: 1; min-width: 0; }
.palette li a .t b { display: block; font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette li a .t span { font-size: 12.5px; color: var(--ink-3); }
.palette li.on a { background: var(--tim-soft); }
.palette li.on a b { color: var(--tim); }
.palette .foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }

/* Loading skeleton */
.skel { border-radius: 10px; background: linear-gradient(90deg, var(--paper-3), var(--paper-2), var(--paper-3)); background-size: 200% 100%; animation: sk 1.2s infinite linear; }
@keyframes sk { to { background-position: -200% 0; } }
.boot { display: grid; place-items: center; height: 100vh; color: var(--ink-3); gap: 12px; }

/* Stars rating */
.stars-pick { display: flex; gap: 4px; }
.stars-pick button { border: 0; background: transparent; font-size: 32px; line-height: 1; color: var(--line-2); cursor: pointer; padding: 2px; }
.stars-pick button.on { color: var(--cam); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Print: chỉ in chứng nhận */
@media print {
  body { background: #fff !important; }
  .side, .topbar, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; }
  .cert { box-shadow: none; page-break-inside: avoid; }
  .print-hide { display: none !important; }
}

@media (max-width: 600px) {
  .ed-bar .btn-ghost { padding: 0 8px; }
  .ed-bar .btn-ghost .lbl { display: none; }
  .ws-scroll { padding: 16px; }
  .exam-bar { gap: 10px; padding: 10px 12px; }
  .timer { font-size: 19px; }
  .page-head h1 { font-size: 26px; }
}

@media (max-width: 560px) {
  .lp-top-in { padding: 0 14px; gap: 6px; }
  .lp-top .btn-ghost[data-auth] { display: none; }
  .lp-top .btn-primary { padding: 0 12px; }
  .lp-wrap { padding: 0 16px; }
  .lp-proof { gap: 16px 22px; }
  .lp-band { padding: 28px 22px; }
  .lp-cta .btn { flex: 1 1 100%; }
}
.dash-hero > *, .two-col > *, .stack > *, .ch-layout > * { min-width: 0; }
@media (max-width: 560px) {
  .ring-card { flex-wrap: wrap; justify-content: center; }
  .ring-card dl { flex-basis: 100%; }
  .path-row .bar, .path-row > span:nth-last-child(2) { display: none; }
  .continue { padding: 20px; }
}
@media (max-width: 560px) { .notebook-head .muted { display: none; } .lp-hero { padding-top: 24px; } }

/* =========================================================
   2.1 — Phong cách giáo dục: thân thiện, nhiều màu, có game hóa
   ========================================================= */
:root { --r: 12px; --r-lg: 20px; --tim-deep: var(--brand-deep, #3C24A8); --la-deep: #0C6B45; --press: 0 3px 0; }
:root[data-theme="dark"] { --tim-deep: color-mix(in srgb, var(--brand, #5B3FD6) 75%, #fff); --la-deep: #2E9C6C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tim-deep: color-mix(in srgb, var(--brand, #5B3FD6) 75%, #fff); --la-deep: #2E9C6C; } }
body { font-size: 16px; }
.btn { border-radius: 12px; box-shadow: 0 2px 0 var(--line-2); font-weight: 700; }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn-primary { box-shadow: 0 4px 0 var(--tim-deep); }
.btn-primary:active { box-shadow: 0 1px 0 var(--tim-deep); }
.btn-run { box-shadow: 0 4px 0 var(--la-deep); }
.btn-ghost, .continue .btn-ghost { box-shadow: none; }
.btn-lg { border-radius: 14px; min-height: 50px; }
.sheet { border-radius: 20px; }
.tag { font-weight: 700; }

/* Linh vật + bong bóng thoại */
.mascot { flex: none; }
.mascot.cheer { animation: hop 1.2s ease-in-out infinite; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.bubble { position: relative; background: var(--paper-2); color: var(--ink); border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; font-weight: 600; font-size: 14.5px; }
.bubble::before { content: ""; position: absolute; left: -9px; top: 22px; width: 14px; height: 14px; background: inherit; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); }

/* Dashboard 2.1 */
.dash2 { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.dash2 > * { min-width: 0; }
@media (max-width: 1080px) { .dash2 { grid-template-columns: 1fr; } }
.hero-learn { display: flex; gap: 20px; align-items: center; padding: 24px 26px; border-radius: 24px; background: var(--tim); color: #fff; position: relative; overflow: hidden; box-shadow: 0 6px 0 var(--tim-deep); }
:root[data-theme="dark"] .hero-learn { background: color-mix(in srgb, var(--brand, #5B3FD6) 68%, #000); }
.hero-learn::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.07); }
.hero-learn .txt { flex: 1; min-width: 0; position: relative; z-index: 1; }
.hero-learn .hello { opacity: .85; font-weight: 600; }
.hero-learn h1 { color: #fff; margin-top: 4px; font-size: clamp(24px, 3vw, 32px); }
.hero-learn .next { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.2); }
.hero-learn .next small { opacity: .8; display: block; font-size: 13px; }
.hero-learn .next b { font-size: 17px; }
.hero-learn .actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.hero-learn .btn-primary { --b-bg: #fff; --b-ink: #2C1C86; --b-line: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.hero-learn .btn-ghost { --b-ink: #fff; }
.hero-learn .btn-ghost:hover { --b-bg: rgba(255,255,255,.14); }
@media (max-width: 600px) { .hero-learn { padding: 20px; } .hero-learn .mascot { display: none; } }

.side-cards { display: grid; gap: 14px; }
.mini { padding: 16px 18px; border-radius: 20px; background: var(--paper-2); border: 1px solid var(--line); box-shadow: 0 3px 0 var(--line); }
.mini h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.goal-box { display: flex; gap: 16px; align-items: center; }
.goal-box p { font-size: 14px; color: var(--ink-2); }
.goal-box select { margin-top: 6px; min-height: 32px; padding: 2px 8px; font-size: 13px; width: auto; }
.streak-box { display: flex; gap: 14px; align-items: center; }
.flame { font-size: 40px; line-height: 1; filter: grayscale(1) opacity(.45); }
.flame.on { filter: none; animation: flick 2s ease-in-out infinite; }
@keyframes flick { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.08) rotate(2deg); } }
.streak-box b { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; display: block; }
.week-dots { display: flex; gap: 6px; margin-top: 12px; }
.week-dots span { flex: 1; text-align: center; font-size: 11px; color: var(--ink-3); font-weight: 700; }
.week-dots i { display: block; height: 26px; border-radius: 8px; background: var(--paper-3); margin-bottom: 4px; }
.week-dots i.on { background: #FF9F1C; }
.week-dots i.today { outline: 2px solid var(--tim); outline-offset: 1px; }
.lvl-bar .lvl-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; margin-bottom: 6px; }
.lvl-bar .lvl-meta span { color: var(--ink-3); }
.lvl-bar .bar { height: 12px; }
.lvl-bar .bar > i { background: linear-gradient(90deg, var(--tim), #A78BFA); }
.lvl-chip { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--vang); color: #5A3F00; font-weight: 800; font-size: 18px; box-shadow: 0 3px 0 #C9A400; flex: none; }

/* Thông báo lớp */
.notice { display: flex; gap: 14px; padding: 16px 18px; border-radius: 18px; background: var(--paper-2); border: 1px solid var(--line); border-left: 5px solid var(--tim); }
.notice.pin { border-left-color: #F2B000; background: color-mix(in srgb, var(--vang) 12%, var(--paper-2)); }
.notice .ic { font-size: 22px; line-height: 1.2; }
.notice b { display: block; }
.notice p { color: var(--ink-2); font-size: 14.5px; margin-top: 4px; white-space: pre-line; }
.notice .meta { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.notices { display: grid; gap: 10px; margin-bottom: 18px; }

/* Thẻ khóa học */
.courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.course { --gc: var(--tim); display: flex; flex-direction: column; border-radius: 20px; overflow: hidden; background: var(--paper-2); border: 2px solid var(--line); text-decoration: none; color: inherit; transition: transform .15s, border-color .15s; box-shadow: 0 4px 0 var(--line); }
.course:hover { transform: translateY(-3px); border-color: var(--gc); }
.course .banner { position: relative; height: 104px; background: var(--gc); display: flex; align-items: flex-end; padding: 12px 16px; overflow: hidden; }
.course .banner::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.22) 1.5px, transparent 1.6px); background-size: 14px 14px; }
.course .banner .emo { position: absolute; right: 12px; top: 8px; font-size: 54px; line-height: 1; filter: drop-shadow(0 4px 0 rgba(0,0,0,.15)); }
.course .banner .lvl { position: relative; background: rgba(255,255,255,.9); color: #1A2035; font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 99px; }
.course .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.course .body strong { font-size: 17px; line-height: 1.3; }
.course .body span.sub { color: var(--ink-3); font-size: 13.5px; line-height: 1.45; }
.course .foot { margin-top: auto; padding-top: 10px; }
.course .foot .row { justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.course .bar > i { background: var(--gc); }
.course.done { border-color: var(--la); }

/* Bản đồ học tập (zigzag) */
.map { position: relative; display: grid; justify-items: center; gap: 14px; padding: 18px 0 30px; }
.map-unit { width: 100%; max-width: 560px; margin: 18px 0 6px; padding: 14px 18px; border-radius: 18px; background: var(--gc, var(--tim)); color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 12px; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.map-unit b { font-size: 16px; }
.map-unit span { font-size: 13px; opacity: .9; }
.node-wrap { --x: 0px; transform: translateX(var(--x)); display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.node { --p: 0; --nc: var(--tim); width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; text-decoration: none;
  background: conic-gradient(var(--nc) calc(var(--p) * 1%), var(--paper-3) 0); position: relative; transition: transform .12s; }
.node:hover { transform: scale(1.06); }
.node .in { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); font-size: 22px; font-weight: 800; color: var(--nc); box-shadow: inset 0 -4px 0 rgba(0,0,0,.08); }
.node.done { --nc: var(--la); }
.node.done .in { background: var(--la); color: #fff; box-shadow: inset 0 -5px 0 var(--la-deep); }
.node.cur .in { background: var(--tim); color: #fff; box-shadow: inset 0 -5px 0 var(--tim-deep); }
.node.cur::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--tim); opacity: .5; animation: ping 1.8s ease-out infinite; }
@keyframes ping { from { transform: scale(.9); opacity: .6; } to { transform: scale(1.25); opacity: 0; } }
.node.lock { --nc: var(--line-2); cursor: default; }
.node.lock .in { color: var(--ink-3); background: var(--paper-3); }
.node.exam .in { font-size: 26px; }
.node-label { max-width: 190px; text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-2); line-height: 1.3; }
.node-label small { display: block; font-weight: 600; color: var(--ink-3); font-size: 12px; }
.here { position: absolute; left: calc(100% + 10px); top: 2px; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.here .bubble { font-size: 13px; padding: 6px 10px; }
@media (max-width: 640px) { .node-wrap { --x: 0px !important; } .here { display: none; } }

/* Huy hiệu */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge { --bc: var(--tim); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 14px 10px 12px; border-radius: 18px; background: var(--paper-2); border: 2px solid var(--line); }
.badge .medal { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; background: var(--paper-3); filter: grayscale(1); opacity: .55; margin-bottom: 4px; }
.badge.ok { border-color: color-mix(in srgb, var(--bc) 45%, var(--line)); }
.badge.ok .medal { background: color-mix(in srgb, var(--bc) 18%, var(--paper-2)); filter: none; opacity: 1; box-shadow: 0 0 0 4px color-mix(in srgb, var(--bc) 35%, transparent), 0 4px 0 color-mix(in srgb, var(--bc) 50%, transparent); }
.badge b { font-size: 13.5px; }
.badge span { font-size: 12px; color: var(--ink-3); line-height: 1.35; }
.badge .bprog { display: block; width: 80%; height: 5px; border-radius: 9px; background: var(--paper-3); overflow: hidden; margin-top: 4px; }
.badge .bprog i { display: block; height: 100%; background: var(--bc); }
.badge.sm { padding: 10px 8px; }
.badge.sm .medal { width: 46px; height: 46px; font-size: 22px; }
.badge-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; }
.badge-strip .badge { min-width: 128px; }

/* Ăn mừng */
.cel-modal { width: min(100%, 440px); text-align: center; overflow: hidden; }
.cel-modal .cel-mascot { display: grid; place-items: center; margin-top: 4px; }
.cel-modal h2 { margin-top: 8px; font-size: 24px; }
.cel-xp { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 14px; }
.xp-pill { display: inline-block; padding: 6px 14px; border-radius: 99px; background: var(--vang); color: #5A3F00; font-weight: 800; font-size: 18px; box-shadow: 0 3px 0 #C9A400; }
.cel-badges { margin-top: 16px; text-align: left; }
.cel-badges .badges { margin-top: 6px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

/* Đánh dấu + ghi chú */
.bm-btn { border: 0; background: transparent; cursor: pointer; font-size: 22px; line-height: 1; color: var(--line-2); padding: 4px; }
.bm-btn.on { color: #F2B000; }
.note-area { width: 100%; min-height: 220px; padding: 12px 14px; border-radius: 14px; border: 2px dashed var(--line-2); background: color-mix(in srgb, var(--vang) 7%, var(--paper-2)); line-height: 1.6; resize: vertical; }
.note-area:focus { outline: none; border-color: var(--tim); border-style: solid; }

/* Bảng xếp hạng tuần */
.rank-me { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 18px; background: var(--tim-soft); margin-bottom: 16px; }
.rank-me b.n { font-size: 30px; font-weight: 800; color: var(--tim); }
.lb-mini li .list-row { padding: 8px 2px; }
.lb-mini .rk { width: 24px; text-align: center; font-weight: 800; color: var(--ink-3); }
.lb-mini li.me { background: var(--tim-soft); border-radius: 10px; }

/* Landing 2.1 */
.lp-mascot { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.lp-mascot .bubble { max-width: 300px; }
@media (max-width: 600px) { .hero-learn > span[aria-hidden] { display: none; } }

/* 2.1.1 */
.forgot { margin-top: 2px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); text-align: center; }
.forgot b { color: var(--ink); }
.lp-ver { margin-left: 12px; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.lp-ver:empty { display: none; }
.side-ver { margin: 0; font-size: 12px; color: var(--ink-3); text-align: center; }
.side-ver:empty { display: none; }
/* 2.2 */
.mt-banner { background: var(--cam-soft); color: var(--ink); border-bottom: 1px solid var(--line); padding: 10px 20px; text-align: center; font-weight: 600; }
.lp-hero.nodemo { grid-template-columns: minmax(0, 1fr); max-width: 820px; }
.set-group { scroll-margin-top: 80px; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; padding: 14px 0; border-bottom: 1px dashed var(--line); align-items: start; }
.set-row:last-child { border-bottom: 0; }
.set-row .lbl b { display: block; font-size: 14.5px; }
.set-row .lbl span { font-size: 13px; color: var(--ink-3); }
.set-row .multi { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; max-height: 260px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.set-row .multi .check { font-size: 13.5px; }
.set-row.changed { background: color-mix(in srgb, var(--vang) 12%, transparent); border-radius: 10px; padding-left: 10px; padding-right: 10px; }
@media (max-width: 760px) { .set-row { grid-template-columns: 1fr; } }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 44px; height: 26px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + i { background: var(--la); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2.5px solid var(--tim); outline-offset: 2px; }
.save-bar { position: sticky; bottom: 12px; z-index: 15; display: flex; gap: 10px; align-items: center; padding: 12px 16px; margin-top: 16px; border-radius: 16px; background: var(--paper-2); border: 1px solid var(--line); box-shadow: var(--shadow-pop); }
.set-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.set-nav { position: sticky; top: calc(var(--top-h) + 12px); display: grid; gap: 2px; }
.set-nav a { padding: 8px 10px; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none; }
.set-nav a:hover { background: var(--paper-3); }
@media (max-width: 900px) { .set-layout { grid-template-columns: 1fr; } .set-nav { position: static; display: flex; flex-wrap: wrap; } }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }
.menu-pop { position: relative; display: inline-block; }
.tag-off { background: var(--do-soft); color: var(--do); }
.set-layout > *, .set-row > * { min-width: 0; }
.set-row .multi { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.save-bar { flex-wrap: wrap; }
.set-row input.input, .set-row textarea.input, .set-row select { max-width: 100%; }
.table-wrap { position: relative; }
.noscript { padding: 24px; }

/* 2.3 */
.prompt { white-space: pre-wrap; overflow-wrap: anywhere; }
.tests-box { margin-top: 16px; display: grid; gap: 10px; }
.test-case { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.test-case .hd { padding: 6px 12px; background: var(--paper); font-size: 13px; font-weight: 700; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.test-case .grid-2 { gap: 0; }
.test-case pre { margin: 0; padding: 8px 12px; font-size: 13px; white-space: pre-wrap; min-height: 34px; }
.test-case .grid-2 > div + div { border-left: 1px solid var(--line); }
.test-case small { display: block; padding: 6px 12px 0; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.run-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 2px 9px; border-radius: 99px; margin-bottom: 8px; }
.run-status.ok { background: rgba(90,212,156,.15); color: #7EE2B4; }
.run-status.error { background: rgba(255,107,122,.15); color: #FFB3BB; }
.run-status.timeout, .run-status.memory, .run-status.busy, .run-status.crash { background: rgba(242,180,81,.15); color: #F7D08A; }
.stdin-area { width: 100%; min-height: 110px; background: rgba(255,255,255,.04); color: var(--console-ink); border: 1px solid rgba(255,255,255,.12); border-radius: 8px; padding: 8px 10px; font-family: var(--mono); font-size: 13.5px; resize: vertical; }
.stdin-area:focus { outline: 2px solid #A794FF; }
.test-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.test-row textarea { min-height: 64px; font-family: var(--mono); font-size: 13px; }
@media (max-width: 720px) { .test-row { grid-template-columns: 1fr; } .test-case .grid-2 > div + div { border-left: 0; border-top: 1px solid var(--line); } }
