/* ============ PyPath design system ============ */
:root, [data-theme="dark"] {
  /* Black theme */
  --bg: #000000;
  --panel: #0B0B0D;
  --raised: #131316;
  --raised-2: #1C1C21;
  --border: #26262D;
  --border-soft: #1A1A1F;
  --text: #EDEDF0;
  --text-2: #A6A6B0;
  --muted: #74747F;
  --accent: #4F7CFF;
  --accent-hover: #6B91FF;
  --accent-soft: rgba(79, 124, 255, .14);
  --success: #2BB673;
  --success-soft: rgba(43, 182, 115, .14);
  --warning: #F2B441;
  --warning-soft: rgba(242, 180, 65, .14);
  --error: #EF5B5B;
  --error-soft: rgba(239, 91, 91, .14);
  --code-bg: #08080A;
  --code-text: #D7DEEE;
  --shadow: 0 8px 24px rgba(0, 0, 0, .28);
  --tok-keyword: #C792EA;
  --tok-string: #A5D987;
  --tok-number: #F7A85E;
  --tok-comment: #6F7891;
  --tok-builtin: #6FC3FF;
  --tok-def: #FFD479;
  --tok-op: #89DDFF;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F5F7FB;
  --panel: #FFFFFF;
  --raised: #FFFFFF;
  --raised-2: #EEF2F9;
  --border: #D9DFEB;
  --border-soft: #E6EAF2;
  --text: #182033;
  --text-2: #475069;
  --muted: #6B7590;
  --accent: #3D6BF5;
  --accent-hover: #2F5BE0;
  --accent-soft: rgba(61, 107, 245, .10);
  --success: #178A55;
  --success-soft: rgba(23, 138, 85, .10);
  --warning: #A86B00;
  --warning-soft: rgba(242, 180, 65, .18);
  --error: #C93838;
  --error-soft: rgba(201, 56, 56, .10);
  --code-bg: #0F1526;
  --code-text: #D7DEEE;
  --shadow: 0 8px 24px rgba(20, 30, 60, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button { font: inherit; color: inherit; }
code, pre, .mono { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; }
/* Show code exactly as typed: no ">=" → "≥" or "!=" → "≠" ligatures that would confuse beginners. */
code, pre, .mono, textarea, .CodeMirror, .CodeMirror * { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.ic { flex: none; display: inline-block; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ============ Shell ============ */
.app { display: flex; height: 100vh; overflow: hidden; }
.rail {
  width: 64px; flex: none; background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; z-index: 30;
}
.rail-logo { margin-bottom: 10px; display: grid; place-items: center; }
.rail-btn {
  width: 52px; padding: 8px 0 6px; border-radius: 10px; display: flex; flex-direction: column; align-items: center;
  gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 500; transition: background .15s, color .15s;
}
.rail-btn:hover { background: var(--raised); color: var(--text); }
.rail-btn.active { background: var(--accent-soft); color: var(--accent); }
.rail-spacer { flex: 1; }

.sidebar {
  width: 300px; flex: none; background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: margin-left .2s ease; z-index: 25;
}
.app.sidebar-hidden .sidebar { margin-left: -300px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 18px; }
.sidebar-title { font-size: 12px; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
.sidebar-body { overflow-y: auto; flex: 1; padding: 4px 10px 28px; }
.scrim { display: none; }

.sb-level { border-radius: 12px; margin-bottom: 4px; }
.sb-level-head {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 0; background: none;
  border-radius: 12px; cursor: pointer; text-align: left;
}
.sb-level-head:hover { background: var(--raised); }
.sb-level.current > .sb-level-head { background: var(--accent-soft); }
.sb-num {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--raised-2); color: var(--text-2); flex: none;
}
.sb-level.done .sb-num { background: var(--success-soft); color: var(--success); }
.sb-level.locked .sb-num { color: var(--muted); }
.sb-level-text { flex: 1; min-width: 0; }
.sb-level-title { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.sb-level-meta { display: block; font-size: 12px; color: var(--muted); }
.sb-mini { display: block; height: 3px; width: 70%; border-radius: 9px; background: var(--raised-2); margin-top: 6px; overflow: hidden; }
.sb-mini > span { display: block; height: 100%; background: var(--success); }
.sb-caret { color: var(--muted); transition: transform .15s; }
.sb-level.open .sb-caret { transform: rotate(90deg); }
.sb-items { display: none; padding: 4px 0 10px 18px; margin-left: 24px; border-left: 1px solid var(--border); }
.sb-level.open .sb-items { display: block; }
.sb-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text-2);
  font-size: 13.5px; line-height: 1.35; margin: 1px 0;
}
.sb-item:hover { background: var(--raised); color: var(--text); }
.sb-item.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.sb-item .sb-kind { color: var(--muted); }
.sb-item-text { flex: 1; min-width: 0; }
.sb-item-min { font-size: 11.5px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--border); flex: none; }
.dot.started { border-color: var(--warning); background: var(--warning); }
.dot.done { border-color: var(--success); background: var(--success); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px;
  border-bottom: 1px solid var(--border); background: var(--panel);
}
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--muted); }
.crumbs .cur { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--text-2);
  display: grid; place-items: center; cursor: pointer; flex: none; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--raised); color: var(--text); }
#sidebarOpen { display: none; }
.app.sidebar-hidden #sidebarOpen { display: grid; }

.search { position: relative; display: flex; align-items: center; gap: 8px; background: var(--raised); border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; height: 36px; width: 280px; color: var(--muted); }
.search input { border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 14px; width: 100%; }
.search-results { display: none; position: absolute; top: 42px; right: 0; width: 380px; max-height: 420px; overflow-y: auto; background: var(--raised); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 50; }
.search-results.open { display: block; }
.sr-item { display: flex; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-size: 14px; align-items: flex-start; }
.sr-item:hover, .sr-item.sel { background: var(--accent-soft); color: var(--text); }
.sr-item small { display: block; color: var(--muted); font-size: 12px; }
.sr-empty { padding: 12px; color: var(--muted); font-size: 14px; }

.level-progress { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.level-progress:empty { display: none; }
.lp-bar { width: 90px; height: 6px; border-radius: 9px; background: var(--raised-2); overflow: hidden; }
.lp-bar > span { display: block; height: 100%; background: var(--success); border-radius: 9px; }

.main { flex: 1; overflow-y: auto; outline: none; }

/* ============ Common components ============ */
.page { max-width: 1120px; margin: 0 auto; padding: 40px 36px 80px; }
.page-narrow { max-width: 860px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; }
.h1 { font-size: 30px; font-weight: 700; letter-spacing: -.01em; }
.h2 { font-size: 22px; font-weight: 700; }
.sub { color: var(--text-2); margin-top: 6px; font-size: 16px; }
.card { background: var(--raised); border: 1px solid var(--border); border-radius: 16px; padding: 22px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--raised); color: var(--text); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s; white-space: nowrap;
}
.btn:hover { background: var(--raised-2); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.08); color: #fff; }
.btn-ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--raised); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.chip-easy { background: var(--success-soft); color: var(--success); }
.chip-medium { background: var(--warning-soft); color: var(--warning); }
.chip-hard { background: var(--error-soft); color: var(--error); }
.chip-muted { background: var(--raised-2); color: var(--text-2); }
.xp { display: inline-flex; align-items: center; gap: 4px; color: var(--warning); font-weight: 600; font-size: 13px; }
.muted { color: var(--muted); }
.ring { --p: 0; width: 48px; height: 48px; border-radius: 50%; background: conic-gradient(var(--success) calc(var(--p) * 1%), var(--raised-2) 0); display: grid; place-items: center; flex: none; }
.ring > span { width: 38px; height: 38px; border-radius: 50%; background: var(--raised); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--raised); color: var(--text); border: 1px solid var(--border); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); opacity: 0; transition: .2s; z-index: 100; pointer-events: none; font-size: 14px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Home / Map ============ */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-bottom: 28px; }
.hero-main { background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--raised); }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; }
.stat { background: var(--panel); border: 1px solid var(--border-soft); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 13px; }
.continue-card { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.continue-card .label { font-size: 12px; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.continue-card .title { font-size: 20px; font-weight: 700; margin-top: 6px; }
.path { position: relative; display: flex; flex-direction: column; gap: 16px; }
.path::before { content: ""; position: absolute; left: 31px; top: 20px; bottom: 20px; width: 2px; background: var(--border); }
.level-card { position: relative; display: flex; gap: 20px; align-items: center; padding: 20px 22px; color: var(--text); transition: border-color .15s, transform .15s; }
a.level-card:hover { border-color: var(--accent); color: var(--text); }
.level-card.locked { opacity: .6; }
.level-badge { width: 28px; height: 28px; z-index: 1; border-radius: 9px; display: grid; place-items: center; background: var(--raised-2); font-weight: 700; font-size: 13px; color: var(--text-2); margin-left: 0; flex: none; }
.level-card.done .level-badge { background: var(--success); color: #fff; }
.level-card.current .level-badge { background: var(--accent); color: #fff; }
.level-info { flex: 1; min-width: 0; }
.level-info h3 { font-size: 17px; }
.level-info p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.level-meta { display: flex; gap: 14px; margin-top: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.level-meta span { display: inline-flex; align-items: center; gap: 5px; }

/* ============ Level overview ============ */
.level-head { display: flex; gap: 20px; align-items: center; margin-bottom: 24px; }
.item-list { display: flex; flex-direction: column; gap: 12px; }
.item-row { display: flex; align-items: center; gap: 16px; padding: 16px 20px; color: var(--text); transition: border-color .15s, transform .15s; }
a.item-row:hover { transform: translateX(3px); }
a.item-row:hover { border-color: var(--accent); color: var(--text); }
.item-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.item-icon.practice { background: var(--success-soft); color: var(--success); }
.item-icon.challenge { background: var(--warning-soft); color: var(--warning); }
.item-row .grow { flex: 1; min-width: 0; }
.item-row .t { font-weight: 600; }
.item-row .m { color: var(--muted); font-size: 13px; }

/* ============ Lesson ============ */
.lesson-wrap { display: grid; grid-template-columns: minmax(0, 760px) 220px; gap: 40px; justify-content: center; padding: 36px 28px 80px; }
.lesson { font-size: 17.5px; line-height: 1.7; }
.lesson .goal { display: flex; gap: 10px; align-items: center; background: var(--accent-soft); color: var(--text); border-radius: 12px; padding: 12px 16px; margin: 16px 0 8px; font-weight: 500; }
.lesson h2 { font-size: 24px; margin: 40px 0 10px; scroll-margin-top: 20px; }
.lesson h3 { font-size: 19px; margin: 28px 0 8px; }
.lesson p { margin: 10px 0; }
.lesson ul, .lesson ol { padding-left: 24px; margin: 10px 0; }
.lesson li { margin: 6px 0; }
.lesson strong { color: var(--text); font-weight: 650; }
.lesson :not(pre) > code { background: var(--raised-2); color: var(--text); border: 1px solid var(--border-soft); padding: 1px 6px; border-radius: 6px; font-size: .88em; }
.lesson table { border-collapse: collapse; margin: 14px 0; font-size: 15.5px; width: 100%; }
.lesson th, .lesson td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.lesson th { background: var(--raised); }
.term { border-bottom: 1.5px dotted var(--accent); cursor: help; position: relative; }
.term:hover::after, .term:focus::after {
  content: attr(data-tip); position: absolute; left: 0; bottom: calc(100% + 8px); width: max-content; max-width: 280px;
  background: var(--raised-2); color: var(--text); border: 1px solid var(--border); padding: 8px 10px; border-radius: 8px; font-size: 13.5px;
  line-height: 1.45; box-shadow: var(--shadow); z-index: 20; font-weight: 400;
}
.code-block { margin: 14px 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--code-bg); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; background: rgba(255,255,255,.03); border-bottom: 1px solid rgba(255,255,255,.06); font-size: 12px; color: #8E98B3; }
.code-head .btn-run { height: 28px; padding: 0 10px; border-radius: 7px; border: 0; background: var(--success); color: #fff; font-weight: 600; font-size: 12.5px; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.code-head .btn-run:hover { filter: brightness(1.1); }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; color: var(--code-text); font-size: 14.5px; line-height: 1.6; }
.out-block { border-top: 1px solid rgba(255,255,255,.07); background: #050506; }
.out-label { font-size: 11.5px; letter-spacing: .1em; color: #6F7891; padding: 8px 16px 0; font-weight: 600; }
.out-block pre { color: #CFE3D6; padding: 6px 16px 12px; }
.out-block.err pre { color: #FF9C9C; }
.out-block .friendly { color: #FFD7A8; font-family: Inter, sans-serif; font-size: 14px; padding: 8px 16px 0; }
.cm-keyword, .tok-keyword { color: var(--tok-keyword); }
.cm-string, .tok-string { color: var(--tok-string); }
.cm-number, .tok-number { color: var(--tok-number); }
.cm-comment, .tok-comment { color: var(--tok-comment); font-style: italic; }
.cm-builtin, .tok-builtin { color: var(--tok-builtin); }
.cm-def, .tok-def { color: var(--tok-def); }
.cm-operator, .tok-operator { color: var(--tok-op); }
.cm-variable-2 { color: #F3C3C3; }
.cm-property { color: #9FD4FF; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; margin: 16px 0; border: 1px solid; font-size: 16.5px; }
.callout > .ic { margin-top: 4px; }
.callout > div > :first-child { margin-top: 0; }
.callout > div > :last-child { margin-bottom: 0; }
.callout-tip { background: var(--accent-soft); border-color: rgba(79,124,255,.35); }
.callout-tip > .ic { color: var(--accent); }
.callout-warn { background: var(--error-soft); border-color: rgba(239,91,91,.35); }
.callout-warn > .ic { color: var(--error); }
.callout-idea { background: var(--warning-soft); border-color: rgba(242,180,65,.35); }
.callout-idea > .ic { color: var(--warning); }
.callout-title { font-weight: 700; display: block; margin-bottom: 2px; }
.predict { border: 1px dashed var(--accent); border-radius: 14px; padding: 14px 16px; margin: 18px 0; }
.predict .predict-q { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.predict .reveal { margin-top: 10px; }
.predict .predict-answer { display: none; }
.predict.revealed .predict-answer { display: block; }
.predict.revealed .reveal { display: none; }
.try-box { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin: 18px 0; background: var(--raised); }
.try-head { padding: 12px 16px; display: flex; gap: 10px; align-items: flex-start; }
.try-head .ic { color: var(--success); margin-top: 4px; }
.try-box .CodeMirror { height: auto; min-height: 90px; font-size: 14.5px; }
.try-actions { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); align-items: center; flex-wrap: wrap; }
.try-actions input { flex: 1; min-width: 140px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 0 10px; font-family: "JetBrains Mono", monospace; font-size: 13px; }
.quiz { margin-top: 40px; }
.quiz-q { margin: 16px 0; }
.quiz-q .qtext { font-weight: 600; margin-bottom: 8px; }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt { text-align: left; border: 1px solid var(--border); background: var(--panel); border-radius: 10px; padding: 10px 14px; cursor: pointer; font-size: 15.5px; display: flex; gap: 10px; align-items: center; }
.quiz-opt:hover { border-color: var(--accent); }
.quiz-opt.right { border-color: var(--success); background: var(--success-soft); }
.quiz-opt.wrong { border-color: var(--error); background: var(--error-soft); }
.quiz-why { margin-top: 8px; font-size: 15px; color: var(--text-2); display: none; }
.quiz-q.answered .quiz-why { display: block; }
.remember { margin-top: 32px; border: 1px solid rgba(43,182,115,.4); background: var(--success-soft); border-radius: 14px; padding: 18px 20px; }
.remember h3 { display: flex; gap: 8px; align-items: center; font-size: 18px; margin: 0 0 6px; }
.remember ul { margin: 6px 0 0; padding-left: 22px; }
.lesson-next { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; flex-wrap: wrap; }
.outline { position: sticky; top: 24px; align-self: start; font-size: 13.5px; }
.outline .t { font-size: 12px; letter-spacing: .1em; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.outline a { display: block; color: var(--text-2); padding: 5px 10px; border-left: 2px solid var(--border); }
.outline a:hover, .outline a.on { color: var(--text); border-left-color: var(--accent); }

/* ============ Practice list ============ */
.qtable { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.qtable th { text-align: left; font-size: 12px; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 0 14px; }
.qtable td { background: var(--raised); padding: 14px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: 14.5px; }
.qtable td:first-child { border-left: 1px solid var(--border); border-radius: 12px 0 0 12px; font-weight: 600; }
.qtable td:last-child { border-right: 1px solid var(--border); border-radius: 0 12px 12px 0; text-align: right; }
.qtable tr { cursor: pointer; }
.qtable tr:hover td { border-color: var(--accent); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.status.solved { color: var(--success); }
.status.attempted { color: var(--warning); }
.status.new { color: var(--muted); }
.filters { display: flex; gap: 8px; margin: 18px 0 6px; flex-wrap: wrap; }
.filters .btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* ============ Question page ============ */
.qpage { display: flex; height: 100%; min-height: 0; }
.qleft { width: 45%; min-width: 280px; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--panel); }
.qright { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.divider { width: 6px; cursor: col-resize; background: transparent; flex: none; margin-left: -3px; margin-right: -3px; z-index: 5; }
.divider:hover, .divider.drag { background: var(--accent-soft); }
.tabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--border); flex: none; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; flex: none; border: 0; background: none; padding: 10px 14px; border-radius: 8px 8px 0 0; color: var(--text-2); cursor: pointer; font-weight: 600; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tabpane { flex: 1; overflow-y: auto; padding: 22px 24px 40px; display: none; }
.tabpane.on { display: block; }
.qtitle { font-size: 22px; font-weight: 700; }
.qmeta { display: flex; gap: 10px; align-items: center; margin: 10px 0 18px; flex-wrap: wrap; }
.qdesc { font-size: 16px; line-height: 1.7; }
.qdesc p { margin: 8px 0; }
.qdesc h4 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; }
.qdesc ul { margin: 6px 0; padding-left: 22px; }
.qdesc :not(pre) > code { background: var(--raised-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.sample { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 12px 0; }
.sample-head { padding: 8px 14px; font-size: 13px; font-weight: 600; background: var(--raised); border-bottom: 1px solid var(--border); }
.sample-grid { display: grid; grid-template-columns: 1fr 1fr; }
.sample-grid > div { padding: 10px 14px; }
.sample-grid > div + div { border-left: 1px solid var(--border); }
.sample-grid small { font-size: 11.5px; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.sample-grid pre { margin: 4px 0 0; font-size: 14px; white-space: pre; overflow-x: auto; }
.sample-why { padding: 8px 14px 10px; border-top: 1px solid var(--border); font-size: 14.5px; color: var(--text-2); }
.related { display: inline-flex; gap: 8px; align-items: center; margin-top: 18px; font-weight: 600; }
.hint { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--raised); }
.hint b { color: var(--warning); }
.notes-area { width: 100%; min-height: 260px; background: var(--raised); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 12px; font: inherit; font-size: 15px; resize: vertical; }
.editor-bar { height: 46px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 10px; border-bottom: 1px solid var(--border); background: var(--panel); }
.editor-bar .lang { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0 6px; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.editor-bar .grow { flex: 1; }
.editor-wrap { flex: 1; min-height: 120px; position: relative; background: var(--code-bg); }
.editor-wrap .CodeMirror { position: absolute; inset: 0; height: auto; }
.CodeMirror { font-family: "JetBrains Mono", ui-monospace, monospace; background: var(--code-bg); color: var(--code-text); font-size: 15px; line-height: 1.6; }
.CodeMirror-gutters { background: var(--code-bg); border-right: 1px solid rgba(255,255,255,.06); }
.CodeMirror-linenumber { color: #4D5675; }
.CodeMirror-cursor { border-left: 2px solid #9DB8FF; }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: rgba(79,124,255,.28) !important; }
.CodeMirror-activeline-background { background: rgba(255,255,255,.03); }
.CodeMirror-matchingbracket { color: #fff !important; background: rgba(79,124,255,.35); }
.run-bar { height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-top: 1px solid var(--border); background: var(--panel); }
.run-bar .grow { flex: 1; }
.run-bar .kbd { font-size: 12px; color: var(--muted); }
.console { height: 34%; min-height: 120px; flex: none; display: flex; flex-direction: column; border-top: 1px solid var(--border); background: var(--panel); }
.console-resize { height: 6px; cursor: row-resize; margin-top: -3px; flex: none; }
.console-resize:hover, .console-resize.drag { background: var(--accent-soft); }
.console .tabs { padding-top: 0; }
.console-body { flex: 1; overflow: auto; padding: 12px 14px; }
.console textarea { width: 100%; height: 100%; min-height: 70px; resize: none; background: var(--code-bg); color: var(--code-text); border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-family: "JetBrains Mono", monospace; font-size: 14px; }
.console pre { margin: 0; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.console .friendly { background: var(--warning-soft); color: var(--text); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 14.5px; }
.console .err-raw { color: var(--error); }
.placeholder { color: var(--muted); font-size: 14px; }
.result-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; font-weight: 600; margin-bottom: 12px; }
.result-banner.ok { background: var(--success-soft); color: var(--success); }
.result-banner.bad { background: var(--error-soft); color: var(--error); }
.result-banner .grow { flex: 1; }
.case { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.case-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-weight: 600; font-size: 14px; cursor: pointer; background: var(--raised); }
.case-head .ok { color: var(--success); }
.case-head .bad { color: var(--error); }
.case-body { display: none; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--border); }
.case.open .case-body { display: grid; }
.case-body > div { padding: 8px 12px; min-width: 0; }
.case-body > div + div { border-left: 1px solid var(--border); }
.case-body small { color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; }
.case-body pre { font-size: 13px; overflow-x: auto; white-space: pre; }
.loading-py { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fullscreen-editor .qleft, .fullscreen-editor .divider { display: none; }

/* ============ Glossary / progress / settings ============ */
.gloss-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 20px; }
.gloss-item h3 { font-size: 16px; font-family: "JetBrains Mono", monospace; color: var(--accent); }
.gloss-item p { margin: 6px 0 0; color: var(--text-2); font-size: 15px; }
.gloss-item pre { margin: 10px 0 0; background: var(--code-bg); color: var(--code-text); padding: 8px 10px; border-radius: 8px; font-size: 13px; overflow-x: auto; }
.prog-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.prog-row .bar { flex: 1; height: 8px; background: var(--raised-2); border-radius: 9px; overflow: hidden; }
.prog-row .bar span { display: block; height: 100%; background: var(--accent); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.setting p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.switch { position: relative; width: 44px; height: 24px; border-radius: 99px; background: var(--raised-2); border: 1px solid var(--border); cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-2); transition: .15s; }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on::after { left: 22px; background: #fff; }
.empty { text-align: center; color: var(--muted); padding: 40px; }

/* ============ Responsive ============ */
@media (max-width: 1100px) {
  .lesson-wrap { grid-template-columns: minmax(0, 760px); }
  .outline { display: none; }
  .search { width: 200px; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 64px; top: 0; bottom: 0; box-shadow: var(--shadow); }
  .app.sidebar-hidden .sidebar { margin-left: -380px; }
  .app:not(.sidebar-hidden) .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; }
  #sidebarOpen { display: grid; }
  .hero { grid-template-columns: 1fr; }
  .qpage { flex-direction: column; height: auto; }
  .qleft { width: 100% !important; border-right: 0; border-bottom: 1px solid var(--border); max-height: none; }
  .qleft .tabpane { max-height: 60vh; }
  .divider { display: none; }
  .qleft, .qright { min-width: 0; }
  .main { overflow-x: hidden; }
  .qright { min-height: 80vh; }
  .level-progress { display: none; }
}
@media (max-width: 640px) {
  /* Phones: the main menu becomes a bottom tab bar so pages get the full width. */
  .rail { position: fixed; left: 0; right: 0; bottom: 0; width: auto; height: auto; flex-direction: row; justify-content: space-around; align-items: stretch;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); gap: 0; border-right: 0; border-top: 1px solid var(--border); z-index: 40; }
  .rail-logo, .rail-spacer { display: none; }
  .rail-btn { flex: 1; width: auto; max-width: 72px; padding: 6px 0 4px; font-size: 10px; }
  .main-col { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .sidebar { left: 0; top: 0; bottom: calc(58px + env(safe-area-inset-bottom)); width: 86vw; max-width: 330px; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .search { width: 40px; padding: 0; justify-content: center; }
  .search input { display: none; }
  .search.open { position: fixed; left: 10px; right: 10px; top: 10px; width: auto; z-index: 60; padding: 0 10px; }
  .search.open input { display: block; }
  .search-results { width: calc(100vw - 80px); }
  .page { padding: 22px 16px 48px; }
  .lesson-wrap { padding: 22px 16px 60px; }
  .lesson { font-size: 17px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .h1 { font-size: 25px; }
  .sample-grid, .case-body { grid-template-columns: 1fr; }
  .sample-grid > div + div, .case-body > div + div { border-left: 0; border-top: 1px solid var(--border); }
  .qtable th:nth-child(3), .qtable td:nth-child(3), .qtable th:nth-child(4), .qtable td:nth-child(4) { display: none; }
  .crumbs .hide-sm { display: none; }
}

/* =====================================================================
   v2: accounts, public site, gamification
   ===================================================================== */
.center { text-align: center; }
.tiny { font-size: 12.5px; }
.h3 { font-size: 17px; font-weight: 700; margin: 0; }
.eyebrow { font-size: 12px; letter-spacing: .1em; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; justify-content: center; }
.chip-accent { background: var(--accent-soft); color: var(--accent); }
.status.bad { color: var(--error); }
.confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 300; }

/* ---------- Avatar ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 30% 25%, var(--a), var(--b)); flex: none; line-height: 1; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); user-select: none; }
.avatar.big { box-shadow: 0 0 0 4px var(--raised), 0 0 0 6px var(--accent-soft), inset 0 -4px 0 rgba(0,0,0,.15); }

/* ---------- Top bar user area ---------- */
.user-box { position: relative; display: flex; align-items: center; gap: 10px; }
.user-box:empty { display: none; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); opacity: .7; }
.sync-dot.bad { background: var(--warning); }
.xp-pill { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px; border-radius: 99px; background: var(--warning-soft); color: var(--warning); font-size: 13px; white-space: nowrap; }
.xp-pill:hover { color: var(--warning); filter: brightness(1.1); }
.user-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; display: grid; transition: transform .15s; }
.user-btn:hover { transform: scale(1.06); }
.menu { position: absolute; right: 0; top: 46px; width: 250px; background: var(--raised); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; z-index: 60; animation: pop .15s ease-out; }
.menu-head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 12px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.menu-head b { display: block; font-size: 14px; }
.menu-head span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; max-width: 170px; white-space: nowrap; }
.menu a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 9px; color: var(--text-2); font-size: 14px; }
.menu a:hover { background: var(--raised-2); color: var(--text); }
.menu a.danger:hover { color: var(--error); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* sidebar only on learning pages */
.app.no-sidebar .sidebar, .app.no-sidebar .scrim, .app.no-sidebar #sidebarOpen { display: none !important; }

/* ---------- Modal ---------- */
.modal-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 200; opacity: 0; transition: opacity .18s; }
.modal-scrim.show { opacity: 1; }
.modal { position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 30px 28px 26px; box-shadow: var(--shadow); transform: translateY(10px) scale(.98); transition: transform .2s; }
.modal-scrim.show .modal { transform: none; }
.modal-wide { max-width: 560px; }
.modal-x { position: absolute; top: 12px; right: 12px; }
.modal-emoji { font-size: 60px; line-height: 1; margin-bottom: 10px; animation: bounce .9s ease; }
.modal .muted { margin: 10px 0 0; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
@keyframes bounce { 0% { transform: scale(.3); } 55% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* ---------- Floating XP + badge popups ---------- */
.xp-float { position: fixed; transform: translate(-50%, 0); color: var(--warning); font-weight: 800; font-size: 20px; pointer-events: none; z-index: 250; animation: floatUp 1.4s ease-out forwards; text-shadow: 0 2px 8px rgba(0,0,0,.35); }
@keyframes floatUp { to { transform: translate(-50%, -70px); opacity: 0; } }
.pop-stack { position: fixed; top: 70px; right: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 220; }
.badge-pop { display: flex; gap: 12px; align-items: center; width: 300px; background: var(--raised); border: 1px solid var(--warning); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); color: var(--text); transform: translateX(120%); transition: transform .35s cubic-bezier(.2,1.4,.4,1); }
.badge-pop.show { transform: none; }
.badge-pop:hover { color: var(--text); }
.bp-e { font-size: 34px; }
.badge-pop small { display: block; font-size: 10.5px; letter-spacing: .12em; color: var(--warning); font-weight: 800; }
.badge-pop b { display: block; }
.badge-pop span span { font-size: 13px; color: var(--text-2); }

/* ---------- Rings ---------- */
.ring { transition: background .4s; }
.ring-sm { width: 34px; height: 34px; }
.ring-sm > span { width: 26px; height: 26px; font-size: 9px; }
.ring-lg { width: 78px; height: 78px; }
.ring-lg > span { width: 64px; height: 64px; font-size: 16px; }

/* ---------- Home ---------- */
.hello-row { display: flex; align-items: center; gap: 20px; margin-bottom: 30px; }
.hello-row .grow { flex: 1; min-width: 0; }
.hello-row .h1 { margin-top: 2px; }
.rank-line { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; font-size: 13.5px; }
.rank-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 99px; background: var(--accent-soft); color: var(--text); font-weight: 600; font-size: 13px; }
.xpbar { width: 180px; height: 8px; border-radius: 9px; background: var(--raised-2); overflow: hidden; }
.xpbar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #8F6BFF); border-radius: 9px; transition: width .6s; }
.home-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 20px; margin-bottom: 44px; }
.continue-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; color: var(--text); background: linear-gradient(135deg, rgba(79,124,255,.22), rgba(143,107,255,.10) 60%, transparent), var(--raised); border-color: rgba(79,124,255,.4); transition: transform .15s, border-color .15s; }
.continue-card:hover { color: var(--text); transform: translateY(-2px); border-color: var(--accent); }
.cc-title { font-size: 22px; font-weight: 700; line-height: 1.3; }
.cc-sub { color: var(--text-2); font-size: 14px; margin-bottom: 8px; }
.continue-card .btn { margin-top: auto; }
.goal-card { display: flex; align-items: center; gap: 18px; }
.goal-card b { display: block; font-size: 17px; margin-top: 4px; }
.goal-card p { margin: 6px 0 0; font-size: 13.5px; }
.streak-card .streak-top { display: flex; align-items: center; gap: 12px; }
.flame { font-size: 38px; filter: grayscale(1); opacity: .5; }
.flame.lit { filter: none; opacity: 1; animation: flicker 2.2s infinite; }
@keyframes flicker { 50% { transform: scale(1.08) rotate(-3deg); } }
.big-n { font-size: 30px; }
.week { display: flex; gap: 6px; margin: 14px 0 8px; }
.wd { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--raised-2); }
.wd.on { background: var(--warning); color: #1b1300; }
.wd.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.streak-card p { margin: 0; }
.home-sec { margin-bottom: 44px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.sec-head a { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; font-size: 14px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 8px; padding: 18px; color: var(--text); min-height: 138px; transition: transform .15s, border-color .15s, box-shadow .15s; }
a.tile:hover { color: var(--text); transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.tile.locked { opacity: .45; }
.tile.current { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--raised); }
.tile.done { border-color: rgba(43,182,115,.45); }
.tile-top { display: flex; justify-content: space-between; align-items: center; }
.tile-num { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--raised-2); font-weight: 800; font-size: 14px; color: var(--text-2); }
.tile.current .tile-num { background: var(--accent); color: #fff; }
.tile.done .tile-num { background: var(--success); color: #fff; }
.tile-title { font-weight: 700; font-size: 15.5px; line-height: 1.3; }
.tile-meta { margin-top: auto; font-size: 12.5px; color: var(--muted); }
.badge-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.badge-mini { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 12px; }
.badge-mini span { font-size: 34px; }
.badge-mini b { font-size: 13.5px; }
.badge-mini small { font-size: 12px; color: var(--muted); }
.badge-mini.locked { border-style: dashed; }
.badge-mini.locked span { filter: grayscale(1); opacity: .5; }

/* ---------- Lessons: reading bar, quiz feedback ---------- */
.read-progress { position: sticky; top: 0; height: 3px; z-index: 10; background: transparent; }
.read-progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--success)); transition: width .1s; }
.opt-letter { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--raised-2); font-size: 12px; font-weight: 700; color: var(--text-2); flex: none; }
.quiz-opt.right .opt-letter { background: var(--success); color: #fff; }
.quiz-opt.wrong .opt-letter { background: var(--error); color: #fff; }
.quiz-opt { transition: border-color .15s, background .15s, transform .1s; }
.quiz-opt:active { transform: scale(.99); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.result-banner.ok { animation: pop .25s ease-out; }

/* ---------- Flashcards ---------- */
.flash-top { display: flex; justify-content: space-between; margin-bottom: 14px; }
.flash-card { position: relative; width: 100%; height: 220px; border: 0; padding: 0; background: none; cursor: pointer; perspective: 900px; }
.fc-front, .fc-back { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; padding: 22px; border-radius: 16px; border: 1px solid var(--border); backface-visibility: hidden; transition: transform .45s; text-align: center; }
.fc-front { background: linear-gradient(135deg, var(--accent-soft), transparent), var(--raised-2); }
.fc-front b { font-size: 26px; color: var(--accent); }
.fc-front small { color: var(--muted); }
.fc-back { background: var(--raised-2); transform: rotateY(180deg); font-size: 16px; }
.fc-back pre { margin: 0; background: var(--code-bg); color: var(--code-text); padding: 8px 12px; border-radius: 8px; font-size: 13px; max-width: 100%; overflow-x: auto; }
.flash-card.flipped .fc-front { transform: rotateY(-180deg); }
.flash-card.flipped .fc-back { transform: rotateY(0); }

/* ---------- Profile ---------- */
.profile-head { display: flex; align-items: center; gap: 24px; margin-bottom: 20px; }
.profile-head .grow { flex: 1; min-width: 0; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-row .stat { padding: 18px; }
.stat-row .stat b { font-size: 24px; }
.sec-card { margin-bottom: 24px; }
.heatmap { display: grid; grid-template-rows: repeat(7, 13px); grid-auto-columns: 13px; grid-auto-flow: column; gap: 4px; margin-top: 8px; overflow-x: auto; padding-bottom: 4px; }
.hm { display: block; width: 13px; height: 13px; border-radius: 3px; background: var(--raised-2); }
.hm.hm-future { background: transparent; }
.hm.l1 { background: rgba(43,182,115,.35); } .hm.l2 { background: rgba(43,182,115,.55); } .hm.l3 { background: rgba(43,182,115,.78); } .hm.l4 { background: var(--success); }
.hm-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.hm-legend .hm { width: 11px; height: 11px; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 18px 12px; }
.badge .b-e { font-size: 38px; filter: grayscale(1); opacity: .35; margin-bottom: 4px; }
.badge b { font-size: 14px; }
.badge small { font-size: 12px; color: var(--muted); line-height: 1.4; }
.badge .b-date { margin-top: 6px; font-size: 11.5px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.badge.earned { border-color: rgba(242,180,65,.5); background: linear-gradient(180deg, var(--warning-soft), transparent 60%), var(--raised); }
.badge.earned .b-e { filter: none; opacity: 1; }
.badge.earned .b-date { color: var(--warning); }
.pr-name { width: 230px; color: var(--text); flex: none; font-size: 14.5px; }
.pr-n { width: 64px; text-align: right; }

/* ---------- Leaderboard ---------- */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 18px; margin-bottom: 28px; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 140px; text-align: center; }
.pod b { font-size: 14.5px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-bar { width: 100%; border-radius: 14px 14px 4px 4px; display: grid; place-items: center; font-size: 30px; background: linear-gradient(180deg, var(--accent-soft), var(--raised)); border: 1px solid var(--border); }
.pod-1 .pod-bar { height: 110px; background: linear-gradient(180deg, rgba(242,180,65,.35), var(--raised)); border-color: rgba(242,180,65,.6); }
.pod-2 .pod-bar { height: 80px; }
.pod-3 .pod-bar { height: 60px; }
.lb-list { display: flex; flex-direction: column; gap: 10px; }
.lb-row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; }
.lb-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lb-row.me { border-color: var(--accent); background: linear-gradient(90deg, var(--accent-soft), transparent), var(--raised); }
.lb-n { width: 26px; font-weight: 800; color: var(--muted); text-align: center; }

/* ---------- Certificate ---------- */
.cert-locked { padding: 44px 36px; }
.cert-req { text-align: left; max-width: 520px; margin: 22px auto 26px; }
.certificate { background: #fffdf7; color: #1b2235; border-radius: 18px; padding: 18px; box-shadow: var(--shadow); max-width: 960px; margin: 0 auto; }
.cert-inner { border: 3px double #c9a24a; border-radius: 12px; padding: 48px 56px; text-align: center; background: radial-gradient(circle at 50% 0, rgba(79,124,255,.08), transparent 60%); }
.cert-logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; }
.cert-kicker { margin-top: 26px; letter-spacing: .3em; font-size: 14px; font-weight: 700; color: #a07d28; }
.cert-pre { margin-top: 22px; color: #5a6380; }
.cert-name { font-family: Georgia, "Times New Roman", serif; font-size: 48px; font-weight: 700; margin: 6px 0 4px; color: #1b2235; border-bottom: 1px solid #e3d5ac; display: inline-block; padding: 0 30px 6px; }
.cert-text { max-width: 640px; margin: 18px auto 0; color: #3b4460; line-height: 1.7; }
.cert-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 40px; }
.cert-foot > div:not(.cert-seal) { display: flex; flex-direction: column; min-width: 180px; }
.cert-foot b { font-size: 15px; border-bottom: 1px solid #cdd3e0; padding-bottom: 6px; }
.cert-foot span { font-size: 12px; color: #7a829b; margin-top: 6px; letter-spacing: .1em; text-transform: uppercase; }
.cert-seal { font-size: 54px; }
@media print {
  @page { size: landscape; margin: 10mm; }
  body * { visibility: hidden !important; }
  .certificate, .certificate * { visibility: visible !important; }
  .certificate { position: fixed; left: 0; top: 0; width: 100%; box-shadow: none; }
  .confetti-canvas { display: none; }
}

/* ---------- Settings ---------- */
.set-card { margin-top: 22px; padding: 8px 22px; }
.set-card > .h3 { padding: 16px 0 4px; }
.set-card .setting:last-child { border-bottom: 0; }
.set-user { display: flex; gap: 12px; align-items: center; }
.seg { display: inline-flex; background: var(--raised-2); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 22px; flex-wrap: wrap; }
.seg-sm { margin: 0; }
.seg-btn { border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: 14px; padding: 8px 16px; border-radius: 9px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--raised); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.18); }

/* ---------- Admin ---------- */
.admin-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
.admin-stats .stat { padding: 16px 18px; position: relative; min-height: 86px; }
.stat-ic { position: absolute; top: 14px; right: 14px; color: var(--muted); }
.skel { background: linear-gradient(90deg, var(--raised), var(--raised-2), var(--raised)); background-size: 200% 100%; animation: skel 1.2s infinite; }
@keyframes skel { to { background-position: -200% 0; } }
.admin-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.admin-row { display: flex; align-items: center; gap: 16px; padding: 14px 18px; flex-wrap: wrap; }
.ar-main { flex: 1; min-width: 200px; display: flex; flex-direction: column; }
.ar-main span { font-size: 13px; }
.ar-ref { display: flex; flex-direction: column; min-width: 150px; }
.ar-ref small { font-size: 11px; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.ar-ref code { font-size: 14px; }
.ar-amt { font-weight: 800; min-width: 60px; }
.ar-act { display: flex; gap: 8px; align-items: center; }
.admin-search { width: 100%; max-width: 380px; margin-bottom: 10px; }
.admin-body .callout { margin: 6px 0 14px; }

/* =====================================================================
   Public site (landing, auth, unlock)
   ===================================================================== */
body.public-mode { overflow-y: auto; height: auto; }
.public { min-height: 100vh; display: flex; flex-direction: column; }
.demo-banner { background: var(--warning-soft); color: var(--warning); text-align: center; font-size: 13px; font-weight: 600; padding: 8px 16px; display: flex; gap: 8px; justify-content: center; align-items: center; }
.pub-head { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 20px; padding: 14px max(20px, calc((100vw - 1160px) / 2)); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-soft); }
.pub-logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--text); }
.pub-logo:hover { color: var(--text); }
.pub-nav { display: flex; gap: 4px; margin-left: 18px; flex: 1; }
.pub-nav button { border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: 14.5px; padding: 8px 12px; border-radius: 9px; cursor: pointer; }
.pub-nav button:hover { color: var(--text); background: var(--raised); }
.pub-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.pub-main { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.pub-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 28px max(20px, calc((100vw - 1160px) / 2)); border-top: 1px solid var(--border-soft); font-size: 14px; }
.pub-foot svg { vertical-align: middle; }
.splash { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; }
.land-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; padding: 72px 0 56px; }
.land-copy h1 { font-size: 52px; line-height: 1.08; letter-spacing: -.025em; margin: 20px 0 0; }
.grad { background: linear-gradient(90deg, var(--accent), #8F6BFF 55%, #2BB673); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 18.5px; color: var(--text-2); line-height: 1.65; margin: 20px 0 0; max-width: 560px; }
.land-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.land-trust { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 22px; color: var(--text-2); font-size: 14px; }
.land-trust .ic { color: var(--success); }
.land-trust span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.land-demo { padding: 0; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.35); transform: rotate(.6deg); }
.demo-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--border); }
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #EF5B5B; }
.dots i:nth-child(2) { background: #F2B441; }
.dots i:nth-child(3) { background: #2BB673; }
#demoEd .CodeMirror { height: auto; font-size: 15px; padding: 6px 0; }
.demo-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; }
.demo-out { margin: 0; min-height: 84px; padding: 14px 16px; background: #050506; color: #CFE3D6; font-size: 14px; white-space: pre-wrap; }
.demo-out.err { color: #FF9C9C; }
.land-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 26px; border: 1px solid var(--border); border-radius: 18px; background: var(--raised); text-align: center; }
.land-stats b { display: block; font-size: 34px; letter-spacing: -.02em; }
.land-stats span { color: var(--muted); font-size: 14px; }
.land-sec { padding: 88px 0 0; scroll-margin-top: 70px; }
.land-sec > h2 { font-size: 36px; text-align: center; letter-spacing: -.02em; }
.sec-sub { text-align: center; color: var(--text-2); font-size: 17px; margin: 10px 0 36px; }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feat { padding: 26px; transition: transform .15s, border-color .15s; }
.feat:hover { transform: translateY(-3px); border-color: var(--accent); }
.feat-ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 16px; }
.feat h3 { font-size: 18px; }
.feat p { margin: 8px 0 0; color: var(--text-2); font-size: 15px; }
.cur-list { display: flex; flex-direction: column; gap: 10px; max-width: 860px; margin: 0 auto; }
.cur-item { border: 1px solid var(--border); border-radius: 14px; background: var(--raised); }
.cur-item summary { list-style: none; display: flex; align-items: center; gap: 16px; padding: 16px 20px; cursor: pointer; }
.cur-item summary::-webkit-details-marker { display: none; }
.cur-item summary .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cur-item summary small { color: var(--muted); font-size: 13.5px; }
.cur-item summary > .ic { color: var(--muted); transition: transform .2s; }
.cur-item[open] summary > .ic { transform: rotate(180deg); }
.cur-num { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; flex: none; }
.cur-meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.cur-item ul { list-style: none; margin: 0; padding: 0 20px 16px 70px; display: grid; gap: 8px; }
.cur-item li { display: flex; gap: 10px; align-items: center; color: var(--text-2); font-size: 15px; }
.steps3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 36px; }
.step { padding: 26px; }
.step-n { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; margin-bottom: 14px; }
.step h3 { font-size: 18px; }
.step p { margin: 6px 0 0; color: var(--text-2); }
.price-card { display: grid; grid-template-columns: 1.4fr 1fr; gap: 30px; padding: 40px; max-width: 900px; margin: 0 auto; border-color: rgba(79,124,255,.45); background: linear-gradient(135deg, rgba(79,124,255,.16), transparent 55%), var(--raised); }
.price-left h2 { font-size: 26px; margin: 14px 0 16px; }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ticks li { display: flex; gap: 10px; align-items: center; color: var(--text-2); }
.ticks .ic { color: var(--success); }
.price-right { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; text-align: center; border-left: 1px solid var(--border); padding-left: 30px; }
.price-right .old { color: var(--muted); text-decoration: line-through; font-size: 20px; }
.price-right .now { font-size: 56px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.price-right .btn { margin-top: 18px; width: 100%; justify-content: center; }
.faq { display: grid; gap: 12px; max-width: 760px; margin: 36px auto 0; }
.faq-item { padding: 0; }
.faq-item summary { list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 18px 22px; cursor: pointer; font-weight: 600; font-size: 16px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .ic { color: var(--muted); transition: transform .2s; flex: none; }
.faq-item[open] summary .ic { transform: rotate(45deg); }
.faq-item p { margin: 0; padding: 0 22px 20px; color: var(--text-2); }
.landing { padding-bottom: 90px; }
.policy { max-width: 760px; margin: 0 auto; padding: 48px 0 80px; font-size: 16.5px; line-height: 1.75; }
.policy h1 { font-size: 34px; letter-spacing: -.02em; }
.policy h2 { font-size: 20px; margin: 30px 0 6px; }
.policy ul { padding-left: 22px; }
.policy li { margin: 6px 0; }
.contact-card { margin: 18px 0; }
.contact-card p { margin: 0 0 14px; }
.contact-card p:last-child { margin-bottom: 0; }
.pub-foot .muted a { color: var(--text-2); }
.pub-foot .muted a:hover { color: var(--text); }
.pay-main { border-color: rgba(79,124,255,.5); background: linear-gradient(135deg, rgba(79,124,255,.14), transparent 60%), var(--raised); }
.pay-amount { display: flex; align-items: baseline; gap: 12px; margin: 18px 0 16px; }
.pay-amount span { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.pay-amount s { color: var(--muted); font-size: 18px; }

/* auth */
.auth-wrap { display: flex; justify-content: center; align-items: flex-start; gap: 36px; padding: 56px 0 80px; flex-wrap: wrap; }
.auth-card { width: 100%; max-width: 460px; padding: 34px 32px; }
.auth-card h1 { font-size: 28px; }
.auth-card > .muted { margin: 8px 0 22px; }
.auth-side { width: 320px; padding-top: 10px; }
.auth-preview { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px; border: 1px dashed var(--border); border-radius: 18px; margin-bottom: 22px; }
.ap-name { font-size: 20px; font-weight: 700; margin-top: 8px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field input { width: 100%; height: 46px; border-radius: 11px; border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 0 14px; font: inherit; font-size: 15.5px; transition: border-color .15s, box-shadow .15s; }
.field input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-eye { position: absolute; right: 6px; top: 6px; width: 34px; height: 34px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px; display: grid; place-items: center; }
.form-row { display: flex; justify-content: space-between; margin: -4px 0 16px; font-size: 14px; }
.form-err { background: var(--error-soft); color: var(--error); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin: 0 0 14px; }
.auth-card form > .muted { margin-top: 18px; }
.avatar-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; }
.av-opt { border: 2px solid transparent; background: var(--panel); border-radius: 14px; padding: 4px; cursor: pointer; display: grid; place-items: center; transition: transform .12s, border-color .12s; }
.av-opt:hover { transform: scale(1.08); }
.av-opt.on { border-color: var(--accent); background: var(--accent-soft); }

/* unlock */
.unlock-wrap { max-width: 900px; margin: 0 auto; padding: 48px 0 80px; }
.unlock-head { display: flex; gap: 18px; align-items: center; margin-bottom: 26px; }
.unlock-head h1 { font-size: 28px; }
.unlock-head p { margin: 6px 0 0; }
.price-inline { color: var(--text); font-size: 18px; }
.unlock-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.unlock-wrap:has(.unlock-grid > :only-child), .unlock-wrap:has(.unlock-grid[hidden]) { max-width: 620px; }
.pay-card { padding: 28px; }
.pay-card h3 { display: flex; gap: 8px; align-items: center; font-size: 19px; margin-bottom: 8px; }
.pay-steps { padding-left: 22px; color: var(--text-2); margin: 12px 0; }
.pay-steps li { margin: 6px 0; }
.qr-box { display: grid; place-items: center; background: #fff; border-radius: 16px; padding: 10px; width: 240px; max-width: 100%; margin: 14px auto; }
.qr-box svg { width: 100%; height: auto; display: block; }
.upi-id { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; margin: 10px 0; background: var(--panel); }
.upi-id span { font-size: 12px; color: var(--muted); font-weight: 700; width: 92px; flex: none; letter-spacing: .04em; text-transform: uppercase; }
.upi-id code { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.status-card { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.status-card p { margin: 6px 0 0; }
.status-card.pending { border-color: rgba(242,180,65,.6); background: linear-gradient(90deg, var(--warning-soft), transparent), var(--raised); }
.status-card.bad { border-color: rgba(239,91,91,.5); color: var(--text); }
.status-card.bad > .ic { color: var(--error); }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--warning); margin-top: 6px; flex: none; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(242,180,65,.6); } 100% { box-shadow: 0 0 0 14px rgba(242,180,65,0); } }

/* ---------- Responsive (v2) ---------- */
@media (max-width: 1100px) {
  .home-grid { grid-template-columns: 1fr 1fr; }
  .continue-card { grid-column: 1 / -1; }
  .land-hero { grid-template-columns: 1fr; padding-top: 48px; }
  .land-copy h1 { font-size: 42px; }
  .feat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .pub-nav { display: none; }
  .admin-stats, .stat-row { grid-template-columns: repeat(2, 1fr); }
  .xp-pill { display: none; }
}
@media (max-width: 640px) {
  .page { padding: 26px 16px 60px; }
  .home-grid { grid-template-columns: 1fr; gap: 14px; margin-bottom: 34px; }
  .hello-row { gap: 14px; }
  .hello-row .avatar { width: 52px !important; height: 52px !important; font-size: 28px !important; }
  .xpbar { width: 120px; }
  .tile-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .tile { min-height: 124px; padding: 14px; }
  .badge-row { grid-template-columns: repeat(2, 1fr); }
  .profile-head { flex-direction: column; text-align: center; }
  .profile-head .rank-line { justify-content: center; }
  .pr-name { width: 130px; font-size: 13.5px; }
  .podium { gap: 8px; }
  .pod { width: 104px; }
  .land-copy h1 { font-size: 34px; }
  .lead { font-size: 16.5px; }
  .land-sec { padding-top: 64px; }
  .land-sec > h2 { font-size: 28px; }
  .land-stats { grid-template-columns: repeat(2, 1fr); padding: 18px; }
  .land-stats b { font-size: 28px; }
  .feat-grid, .steps3 { grid-template-columns: 1fr; }
  .price-card { grid-template-columns: 1fr; padding: 26px; }
  .price-right { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 22px; }
  .cur-item ul { padding-left: 20px; }
  .cur-meta { display: none; }
  .pub-head { padding: 12px 16px; gap: 10px; }
  .pub-actions { gap: 4px; }
  .pub-actions .btn { height: 36px; padding: 0 12px; font-size: 13px; }
  .pub-logo span { display: none; }
  .policy { padding: 28px 0 56px; }
  .policy h1 { font-size: 27px; }
  .auth-wrap { padding: 28px 0 56px; }
  .auth-card { padding: 26px 20px; }
  .auth-side { display: none; }
  .unlock-wrap { padding: 28px 0 56px; }
  .unlock-head h1 { font-size: 22px; }
  .cert-inner { padding: 28px 18px; }
  .cert-name { font-size: 32px; padding: 0 10px 6px; }
  .cert-foot { flex-direction: column; gap: 18px; }
  .badge-pop { width: calc(100vw - 36px); }
  .admin-stats { grid-template-columns: 1fr 1fr; }
}

/* Touch screens have no keyboard shortcuts */
@media (hover: none) { .run-bar .kbd { display: none; } }

/* =================== Cinematic landing (hero + scroll story) =================== */
.bleed { width: 100vw; margin-left: calc(50% - 50vw); position: relative; }
.cine-hero { min-height: calc(100vh - 64px); min-height: calc(100svh - 64px); display: flex; align-items: center; justify-content: center; overflow: hidden; text-align: center; padding: 40px 20px 90px; }
.cine-bg { position: absolute; inset: 0; pointer-events: none; }
.cine-glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; animation: glowDrift 14s ease-in-out infinite alternate; }
.cine-glow.g1 { width: 46vw; height: 46vw; left: -8vw; top: -12vw; background: radial-gradient(circle, rgba(79,124,255,.55), transparent 65%); }
.cine-glow.g2 { width: 40vw; height: 40vw; right: -10vw; bottom: -14vw; background: radial-gradient(circle, rgba(143,107,255,.45), transparent 65%); animation-delay: -6s; }
@keyframes glowDrift { to { transform: translate(4vw, 3vw) scale(1.12); } }
.cine-grid { position: absolute; inset: 0; background-image: linear-gradient(var(--border-soft) 1px, transparent 1px), linear-gradient(90deg, var(--border-soft) 1px, transparent 1px); background-size: 56px 56px; -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%); mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%); opacity: .7; }
.cine-tok { position: absolute; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 15px; color: var(--text-2); opacity: .22; white-space: nowrap; will-change: transform; }
.cine-tok.t0 { left: 8%; top: 18%; } .cine-tok.t1 { right: 7%; top: 14%; } .cine-tok.t2 { left: 12%; top: 72%; }
.cine-tok.t3 { right: 14%; top: 66%; } .cine-tok.t4 { left: 4%; top: 45%; } .cine-tok.t5 { right: 4%; top: 42%; }
.cine-tok.t6 { left: 30%; top: 88%; } .cine-tok.t7 { right: 30%; top: 8%; } .cine-tok.t8 { left: 24%; top: 6%; } .cine-tok.t9 { right: 24%; top: 86%; }
.cine-copy { position: relative; max-width: 980px; }
.cine-title { margin: 22px 0 0; font-size: clamp(52px, 10.5vw, 136px); line-height: .98; letter-spacing: -.045em; font-weight: 800; }
.ct-line { display: block; opacity: 0; transform: translateY(40px); animation: ctIn .9s cubic-bezier(.2,.7,.2,1) forwards; }
.ct-line + .ct-line { animation-delay: .18s; }
@keyframes ctIn { to { opacity: 1; transform: none; } }
.cine-lead { font-size: clamp(17px, 2vw, 21px); color: var(--text-2); max-width: 640px; margin: 26px auto 0; line-height: 1.55; opacity: 0; animation: ctIn .9s .4s forwards; }
.cine-cta { justify-content: center; opacity: 0; animation: ctIn .9s .55s forwards; }
.cine-copy .land-trust { justify-content: center; opacity: 0; animation: ctIn .9s .7s forwards; }
.cine-scroll { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; background: none; border: 0; color: var(--text-2); font: inherit; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; cursor: pointer; }
.cine-scroll i { width: 22px; height: 36px; border: 2px solid var(--border); border-radius: 12px; position: relative; }
.cine-scroll i::after { content: ''; position: absolute; left: 50%; top: 7px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--text-2); animation: wheel 1.6s ease-in-out infinite; }
@keyframes wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

/* Scroll story: a tall section with a sticky stage */
.story { height: 520vh; }
.story-stage { position: -webkit-sticky; position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; align-items: center; gap: 4vw; padding: 70px max(24px, calc((100vw - 1240px) / 2)) 30px; overflow: hidden; }
.story-caps { position: relative; height: 260px; }
.story-cap { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; opacity: 0; transform: translateY(26px); transition: opacity .5s, transform .5s; }
.story-cap.on { opacity: 1; transform: none; }
.cap-n { font-family: "JetBrains Mono", monospace; color: var(--accent); font-size: 14px; letter-spacing: .1em; }
.story-cap h2 { font-size: clamp(30px, 3.6vw, 48px); line-height: 1.05; letter-spacing: -.03em; margin: 10px 0 14px; }
.story-cap p { color: var(--text-2); font-size: 18px; line-height: 1.5; margin: 0; }
.story-devices { position: relative; height: 100%; display: flex; align-items: center; justify-content: center; perspective: 1600px; }

/* Laptop */
.lap { width: min(760px, 100%); transform: translateX(calc(var(--phone, 0) * -9%)) scale(calc(.86 + var(--open, 0) * .14 - var(--phone, 0) * .06)); transition: transform .08s linear; }
.lap-lid { aspect-ratio: 16 / 10; background: #0b0b0e; border: 1px solid #2a2a31; border-radius: 16px 16px 4px 4px; padding: 2.4%; transform-origin: 50% 100%; transform: rotateX(calc((1 - var(--open, 0)) * -92deg)); box-shadow: 0 30px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.03) inset; }
.lap-screen { height: 100%; border-radius: 6px; background: var(--code-bg, #08080A); border: 1px solid #1d1d23; display: flex; flex-direction: column; overflow: hidden; font-size: clamp(9px, 1.25vw, 16px); opacity: calc(.2 + var(--open, 0) * .8); }
.lap-base { height: 16px; width: 114%; margin-left: -7%; background: linear-gradient(#3a3a42, #1b1b20); border-radius: 2px 2px 16px 16px; position: relative; }
.lap-base::before { content: ''; position: absolute; left: 50%; top: 0; width: 16%; height: 6px; margin-left: -8%; background: #121216; border-radius: 0 0 8px 8px; }
.ed-bar { display: flex; align-items: center; gap: 12px; padding: .7em 1em; border-bottom: 1px solid #1d1d23; color: #8A90A2; font-size: .85em; }
.ed-bar .dots { display: flex; gap: 6px; } .ed-bar .dots i { width: .7em; height: .7em; border-radius: 50%; background: #2a2a31; }
.ed-file { flex: 1; font-family: "JetBrains Mono", monospace; }
.ed-run { background: var(--success); color: #fff; font-weight: 700; padding: .35em .9em; border-radius: 7px; transition: transform .15s, box-shadow .15s; }
.ed-run.pressed { transform: scale(.9); box-shadow: 0 0 0 6px rgba(43,182,115,.25); }
.ed-body { flex: 1; display: flex; gap: 1em; padding: 1em; font-family: "JetBrains Mono", monospace; line-height: 1.75; }
.ed-lines { color: #3c4253; text-align: right; user-select: none; }
.ed-code { margin: 0; color: var(--code-text, #D7DEEE); white-space: pre; font: inherit; }
.ed-code.has-err .tk-v:last-of-type { text-decoration: underline wavy var(--error); text-underline-offset: 4px; }
.tk-v { color: var(--code-text, #D7DEEE); } .tk-o { color: var(--tok-op); } .tk-p { color: #8A90A2; } .tk-n { color: var(--tok-number); } .tk-s { color: var(--tok-string); } .tk-b { color: var(--tok-builtin); }
.tk-fix { color: var(--success); font-weight: 700; animation: fixPop .4s ease-out; display: inline-block; }
@keyframes fixPop { from { transform: scale(2.2); } }
.caret { display: inline-block; width: .55em; height: 1.15em; vertical-align: -.2em; background: var(--accent); margin-left: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ed-out { min-height: 5.2em; border-top: 1px solid #1d1d23; padding: .8em 1em; font-family: "JetBrains Mono", monospace; font-size: .9em; display: flex; flex-direction: column; gap: .4em; transition: background .3s; }
.ed-out.error { background: rgba(239,91,91,.12); color: #FF8A8A; border-top-color: rgba(239,91,91,.5); }
.ed-hint { font-family: Inter, system-ui, sans-serif; color: #FFC2C2; font-size: .95em; }
.ed-out.ok { background: rgba(43,182,115,.1); border-top-color: rgba(43,182,115,.5); }
.ed-print { color: var(--code-text, #D7DEEE); }
.ed-pass { color: #4FD796; font-weight: 700; font-family: Inter, system-ui, sans-serif; animation: fixPop .45s ease-out; }

/* Phone */
.phone { position: absolute; right: 0; bottom: 8%; width: min(236px, 28%); aspect-ratio: 9 / 19; background: #000; border: 9px solid #1c1c22; border-radius: 36px; box-shadow: 0 40px 90px rgba(0,0,0,.6), 0 0 0 1px #2c2c33; opacity: var(--phone, 0); transform: translateX(calc((1 - var(--phone, 0)) * 70%)) rotate(calc((1 - var(--phone, 0)) * 8deg)); overflow: hidden; }
.ph-screen { height: 100%; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; font-size: 12px; color: var(--text); background: radial-gradient(circle at 50% 0, rgba(79,124,255,.18), transparent 60%), #050507; }
.ph-top { display: flex; justify-content: space-between; align-items: center; color: var(--text-2); }
.ph-xp b { color: var(--text); }
.ph-streak { display: flex; align-items: baseline; gap: 6px; padding: 12px; border-radius: 14px; background: #131316; border: 1px solid #26262D; }
.ph-streak b { font-size: 34px; line-height: 1; letter-spacing: -.03em; } .ph-streak span:last-child { color: var(--text-2); }
.ph-flame { font-size: 26px; align-self: center; }
.ph-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.ph-week span { aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: #17171b; color: #5b5f6c; font-size: 10px; font-weight: 700; transition: background .3s, color .3s, transform .3s; }
.ph-week span.on { background: linear-gradient(135deg, #FF9F43, #FF5E3A); color: #fff; transform: scale(1.08); }
.ph-rank { padding: 10px; border-radius: 12px; background: #131316; border: 1px solid #26262D; display: flex; flex-direction: column; gap: 7px; }
.ph-bar { height: 6px; border-radius: 6px; background: #22222a; overflow: hidden; } .ph-bar i { display: block; height: 100%; width: 12%; background: linear-gradient(90deg, var(--accent), #8F6BFF); border-radius: 6px; }
.ph-badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ph-badge { text-align: center; padding: 8px 4px; border-radius: 12px; background: #131316; border: 1px solid #26262D; opacity: .25; transform: scale(.7); transition: opacity .35s, transform .45s cubic-bezier(.3,1.6,.5,1); }
.ph-badge.on { opacity: 1; transform: scale(1); border-color: rgba(242,180,65,.5); }
.ph-badge span { font-size: 20px; display: block; } .ph-badge small { font-size: 9px; color: var(--text-2); }
.ph-next { margin-top: auto; padding: 10px; border-radius: 12px; background: var(--accent); color: #fff; display: flex; flex-direction: column; } .ph-next small { opacity: .8; font-size: 9px; letter-spacing: .1em; }

/* Your turn + reveals */
.try-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 48px; align-items: center; }
.try-h { font-size: clamp(30px, 3.4vw, 44px); letter-spacing: -.03em; line-height: 1.08; margin: 16px 0 12px; }
.try-sec .land-demo { transform: none; }
.rv { opacity: 0; transform: translateY(36px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.rv.in { opacity: 1; transform: none; }

/* Reduced motion: no sticky story, everything shown at once */
.story.static { height: auto; }
.story.static .story-stage { position: relative; height: auto; min-height: 0; grid-template-columns: 1fr; padding-top: 60px; padding-bottom: 60px; }
.story.static .story-caps { height: auto; display: grid; gap: 22px; }
.story.static .story-cap { position: static; opacity: 1; transform: none; }
.story.static .story-devices { min-height: 520px; }
@media (prefers-reduced-motion: reduce) { .ct-line, .cine-lead, .cine-cta, .cine-copy .land-trust { animation: none; opacity: 1; transform: none; } .cine-glow { animation: none; } }

@media (max-width: 900px) {
  .story-stage { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 10px; padding: 76px 16px 24px; }
  .story-caps { height: 150px; }
  .story-cap h2 { font-size: 28px; margin: 6px 0 8px; } .story-cap p { font-size: 15px; }
  .story-devices { align-items: flex-start; padding-top: 4vh; }
  .lap { width: 100%; transform: scale(calc(.9 + var(--open, 0) * .1)) translateY(calc(var(--phone, 0) * -6%)); }
  .phone { width: min(190px, 46vw); right: 2%; bottom: 2%; border-width: 7px; border-radius: 28px; }
  .ph-screen { font-size: 11px; gap: 7px; padding: 11px 9px; }
  .ph-streak b { font-size: 26px; }
  .try-grid { grid-template-columns: 1fr; gap: 24px; }
  .cine-tok { font-size: 12px; }
  .cine-tok.t4, .cine-tok.t5, .cine-tok.t8, .cine-tok.t9 { display: none; }
}
body.public-mode { overflow-x: hidden; overflow-x: clip; }
@media (max-width: 900px) { .lap-screen { font-size: clamp(10px, 2.5vw, 15px); } .lap-lid { aspect-ratio: 4 / 3; } }
.try-sec + .land-stats { margin-top: 72px; }
@media (max-width: 900px) { .cine-tok { opacity: .1; } .try-sec + .land-stats { margin-top: 48px; } }

/* =================== In-app animations (short, rewarding, never in the way) =================== */
@property --p { syntax: '<number>'; inherits: false; initial-value: 0; }

/* 1. Test results tick in one by one */
.tick-in { animation: tickIn .38s cubic-bezier(.2,.8,.3,1) both; animation-delay: calc(var(--i, 0) * 90ms); }
@keyframes tickIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.case.tick-in .case-head .ok, .case.tick-in .case-head .bad { display: inline-grid; animation: iconPop .45s cubic-bezier(.3,1.7,.5,1) both; animation-delay: calc(var(--i, 0) * 90ms + 120ms); }
@keyframes iconPop { from { transform: scale(0) rotate(-40deg); } }
.case.tick-in.fail { animation: tickIn .38s cubic-bezier(.2,.8,.3,1) both, caseShake .45s ease both; animation-delay: calc(var(--i, 0) * 90ms), calc(var(--i, 0) * 90ms + 300ms); border-color: color-mix(in srgb, var(--error) 45%, var(--border)); }
@keyframes caseShake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.result-banner.tick-in.ok { animation: bannerIn .5s cubic-bezier(.3,1.5,.5,1) both; animation-delay: calc(var(--i, 0) * 90ms); }
@keyframes bannerIn { from { opacity: 0; transform: scale(.85); } }

/* 2. XP fly + pill bump */
.xp-pill.bump { animation: pillBump .6s cubic-bezier(.3,1.8,.5,1); }
@keyframes pillBump { 30% { transform: scale(1.22); box-shadow: 0 0 0 6px rgba(242,180,65,.25); } }

/* 3. Home: rings fill, XP bar slides, week dots light up one by one */
.ring { animation: ringFill 1.1s cubic-bezier(.3,.7,.2,1) both; }
@keyframes ringFill { from { --p: 0; } }
.home .xpbar > span, .level-head ~ * .bar > span, .cert-req .bar > span { animation: growW 1s .15s cubic-bezier(.3,.7,.2,1) both; }
@keyframes growW { from { width: 0; } }
.home .week .wd { animation: wdIn .4s cubic-bezier(.3,1.6,.5,1) both; }
.home .week .wd:nth-child(2) { animation-delay: .06s; } .home .week .wd:nth-child(3) { animation-delay: .12s; } .home .week .wd:nth-child(4) { animation-delay: .18s; }
.home .week .wd:nth-child(5) { animation-delay: .24s; } .home .week .wd:nth-child(6) { animation-delay: .30s; } .home .week .wd:nth-child(7) { animation-delay: .36s; }
@keyframes wdIn { from { transform: scale(.4); opacity: 0; } }
.home .tile { animation: tickIn .45s cubic-bezier(.2,.8,.3,1) both; }
.home .tile:nth-child(n+2) { animation-delay: .04s; } .home .tile:nth-child(n+4) { animation-delay: .08s; } .home .tile:nth-child(n+7) { animation-delay: .12s; } .home .tile:nth-child(n+10) { animation-delay: .16s; }
.home .tile.current { box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(79,124,255,.25); }

/* 4. Daily goal burst */
.goal-burst { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 260; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 34px; border-radius: 22px; background: var(--raised); border: 1px solid rgba(242,180,65,.6); box-shadow: 0 30px 80px rgba(0,0,0,.5); text-align: center; animation: gbIn .55s cubic-bezier(.3,1.6,.5,1) both; pointer-events: none; }
.goal-burst.out { animation: gbOut .5s ease forwards; }
.goal-burst b { font-size: 19px; } .goal-burst small { color: var(--text-2); }
.gb-ring { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; background: conic-gradient(var(--warning) 100%, transparent 0); position: relative; animation: gbSpin .8s cubic-bezier(.3,.7,.2,1) both; }
.gb-ring::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--raised); }
.gb-ring span { position: relative; }
.gb-ring::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--warning); animation: gbWave 1.1s .3s ease-out both; }
@keyframes gbIn { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } }
@keyframes gbOut { to { opacity: 0; transform: translate(-50%, -60%) scale(.95); } }
@keyframes gbSpin { from { transform: rotate(-120deg) scale(.6); } }
@keyframes gbWave { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }

/* 5. Badge unlock: flip + shine */
.badge-pop .bp-e { position: relative; display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 14px; background: radial-gradient(circle at 30% 30%, rgba(242,180,65,.35), rgba(242,180,65,.08)); overflow: hidden; }
.badge-pop.show .bp-e { animation: badgeFlip .9s cubic-bezier(.3,1.3,.5,1) both; }
.bp-shine { position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.65) 50%, transparent 70%); transform: translateX(-120%); }
.badge-pop.show .bp-shine { animation: shine 1.1s .6s ease-in-out both; }
@keyframes badgeFlip { from { transform: perspective(300px) rotateY(180deg) scale(.4); } }
@keyframes shine { to { transform: translateX(120%); } }

/* 6. Course map: progress line fills down the path, cards slide in, current level pulses */
.path-anim::after { content: ""; position: absolute; left: 31px; top: 20px; width: 2px; height: calc((100% - 40px) * var(--fill, 0%) / 100%); max-height: calc(100% - 40px); background: linear-gradient(var(--success), var(--accent)); box-shadow: 0 0 10px rgba(79,124,255,.6); border-radius: 2px; animation: pathFill 1.4s .2s cubic-bezier(.3,.7,.2,1) both; }
@keyframes pathFill { from { height: 0; } }
.path-anim > .level-card { animation: tickIn .45s cubic-bezier(.2,.8,.3,1) both; animation-delay: calc(var(--i, 0) * 45ms); }
.level-card.current .level-badge { animation: curPulse 2s ease-out infinite; }
@keyframes curPulse { 0% { box-shadow: 0 0 0 0 rgba(79,124,255,.6); } 70%, 100% { box-shadow: 0 0 0 10px rgba(79,124,255,0); } }
.level-card.done .level-badge { box-shadow: 0 0 12px rgba(43,182,115,.45); }

/* 7. Level complete scene */
.modal .level-done { position: relative; }
.ld-rays { position: absolute; left: 50%; top: 34px; width: 260px; height: 260px; margin-left: -130px; margin-top: -100px; background: repeating-conic-gradient(rgba(242,180,65,.18) 0 10deg, transparent 10deg 20deg); border-radius: 50%; -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 68%); mask-image: radial-gradient(circle, #000 20%, transparent 68%); animation: raysSpin 14s linear infinite; pointer-events: none; }
@keyframes raysSpin { to { transform: rotate(360deg); } }
.ld-trophy { position: relative; font-size: 76px; animation: trophyDrop .9s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes trophyDrop { from { transform: translateY(-60px) scale(.4) rotate(-15deg); opacity: 0; } }
.ld-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 6px; }
.ld-stats > div { background: var(--raised-2); border-radius: 12px; padding: 12px 6px; display: flex; flex-direction: column; animation: tickIn .4s both; }
.ld-stats > div:nth-child(2) { animation-delay: .1s; } .ld-stats > div:nth-child(3) { animation-delay: .2s; }
.ld-stats b { font-size: 26px; letter-spacing: -.02em; } .ld-stats span { font-size: 12px; color: var(--text-2); }

/* 8. Rank-up card flip: old rank → new rank */
.rank-flip { width: 120px; height: 120px; margin: 0 auto 14px; perspective: 600px; }
.rf-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: rankFlip 1.1s .35s cubic-bezier(.5,0,.2,1.3) both; }
.rf-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--border); background: var(--raised-2); }
.rf-face span { font-size: 48px; line-height: 1; } .rf-face small { font-size: 11px; font-weight: 700; color: var(--text-2); }
.rf-new { transform: rotateY(180deg); background: radial-gradient(circle at 50% 30%, rgba(242,180,65,.35), var(--raised-2) 70%); border-color: rgba(242,180,65,.6); box-shadow: 0 0 30px rgba(242,180,65,.3); }
.rf-new small { color: var(--warning); }
@keyframes rankFlip { to { transform: rotateY(180deg); } }

/* 9. Leaderboard: podium rises, rows slide in, your row glows */
.podium .pod-bar { transform-origin: bottom; animation: podRise .8s cubic-bezier(.3,1.3,.5,1) both; }
.podium .pod-2 .pod-bar { animation-delay: .15s; } .podium .pod-3 .pod-bar { animation-delay: .3s; }
@keyframes podRise { from { transform: scaleY(0); } }
.podium .pod .avatar { animation: tickIn .5s .5s both; }
.lb-list .lb-row { animation: lbIn .45s cubic-bezier(.2,.8,.3,1) both; animation-delay: calc(.35s + var(--i, 0) * 50ms); }
@keyframes lbIn { from { opacity: 0; transform: translateX(-18px); } }
.lb-row.me { animation: lbIn .45s cubic-bezier(.2,.8,.3,1) both, meGlow 2.4s 1.2s ease-in-out 2; animation-delay: calc(.35s + var(--i, 0) * 50ms), 1.2s; }
@keyframes meGlow { 50% { box-shadow: 0 0 0 3px rgba(79,124,255,.35), 0 0 26px rgba(79,124,255,.35); } }

/* 10. Certificate reveal: card rises, border draws, name writes in, seal stamps */
.cert-reveal { animation: certIn .8s cubic-bezier(.2,.8,.3,1) both; }
@keyframes certIn { from { opacity: 0; transform: translateY(30px) scale(.97); } }
.cert-reveal .cert-inner { animation: certBorder 1.2s .3s ease both; }
@keyframes certBorder { from { border-color: transparent; } }
.cert-reveal .cert-kicker, .cert-reveal .cert-pre, .cert-reveal .cert-text, .cert-reveal .cert-foot > div:not(.cert-seal) { animation: tickIn .6s both; }
.cert-reveal .cert-kicker { animation-delay: .5s; } .cert-reveal .cert-pre { animation-delay: .7s; } .cert-reveal .cert-text { animation-delay: 1.5s; } .cert-reveal .cert-foot > div:not(.cert-seal) { animation-delay: 1.8s; }
.cert-reveal .cert-name { animation: nameWrite 1s .9s steps(24) both; clip-path: inset(0 0 0 0); }
@keyframes nameWrite { from { clip-path: inset(0 100% 0 0); } }
.cert-reveal .cert-seal { animation: sealStamp .55s 2.2s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes sealStamp { from { transform: scale(3) rotate(-25deg); opacity: 0; } }
@media print { .cert-reveal, .cert-reveal * { animation: none !important; } }

/* 11. Code visualizer */
.code-btns { display: inline-flex; gap: 6px; }
.btn-viz { background: transparent !important; border: 1px solid var(--border) !important; color: var(--text-2) !important; }
.btn-viz:hover { color: var(--text) !important; border-color: var(--accent) !important; }
.viz-scrim { z-index: 300; }
.viz { width: min(1100px, calc(100vw - 24px)); max-height: calc(100vh - 24px); max-height: calc(100svh - 24px); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.vz-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.vz-head b { font-size: 16px; } .vz-sub { color: var(--text-2); font-size: 13px; flex: 1; }
.vz-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.vz-loading { padding: 50px 20px; text-align: center; color: var(--text-2); }
.vz-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1.15fr 1fr; }
.vz-code, .vz-side { min-height: 0; overflow: auto; padding: 14px 16px; }
.vz-side { border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; background: var(--panel, var(--bg)); }
.vz-label { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--muted, var(--text-2)); margin: 2px 0 6px; }
.vz-lines { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 14px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 0; }
.vz-ln { display: flex; align-items: center; gap: 8px; padding: 2px 10px 2px 0; border-left: 3px solid transparent; transition: background .2s, border-color .2s; white-space: pre; }
.vz-ln .n { width: 34px; text-align: right; color: #4a5164; flex: none; }
.vz-ln .arrow { width: 14px; flex: none; text-align: center; }
.vz-ln code { background: none; padding: 0; }
.vz-ln.prev { background: rgba(43,182,115,.08); border-left-color: rgba(43,182,115,.6); }
.vz-ln.prev .arrow::before { content: '→'; color: var(--success); }
.vz-ln.next, .vz-ln.done { background: rgba(79,124,255,.16); border-left-color: var(--accent); }
.vz-ln.next .arrow::before { content: '➜'; color: var(--accent); animation: arrowNudge 1s ease-in-out infinite; display: inline-block; }
.vz-ln.done .arrow::before { content: '✓'; color: var(--success); }
.vz-ln.errl { background: rgba(239,91,91,.16); border-left-color: var(--error); }
.vz-ln.errl .arrow::before { content: '✗'; color: var(--error); }
@keyframes arrowNudge { 50% { transform: translateX(3px); } }
.vz-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.vz-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.lg-next { background: var(--accent); } .lg-prev { background: var(--success); }
.vz-frames { display: flex; flex-direction: column; gap: 10px; }
.vz-frame { border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: var(--raised); }
.vz-fname { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.vz-var { display: flex; align-items: flex-start; gap: 10px; padding: 4px 0; }
.vz-name { font-family: "JetBrains Mono", monospace; font-weight: 700; min-width: 64px; text-align: right; padding-top: 10px; font-size: 13px; }
.vz-val { position: relative; border: 1px solid var(--border); border-radius: 9px; background: var(--raised-2); padding: 14px 10px 6px; min-width: 54px; font-family: "JetBrains Mono", monospace; font-size: 13px; }
.vz-val.chg { animation: valFlash 1s ease; border-color: var(--warning); }
@keyframes valFlash { 0% { box-shadow: 0 0 0 0 rgba(242,180,65,.7); transform: scale(1.06); } 100% { box-shadow: 0 0 0 8px rgba(242,180,65,0); transform: none; } }
.vz-type { position: absolute; top: 2px; left: 8px; font-size: 9px; color: var(--text-2); font-family: Inter, system-ui, sans-serif; letter-spacing: .05em; }
.vz-box b { font-weight: 600; }
.t-str b { color: var(--tok-string); } .t-int b, .t-float b { color: var(--tok-number); } .t-bool b, .t-NoneType b { color: var(--tok-keyword); } .t-function b { color: var(--tok-def); }
.vz-cells { display: flex; flex-wrap: wrap; gap: 0; }
.vz-cell { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--border); margin: -1px 0 0 -1px; padding: 4px 8px 2px; min-width: 34px; background: var(--raised); }
.vz-cell small { font-size: 9px; color: var(--text-2); }
.vz-cell.more { color: var(--text-2); }
.vz-dict .vz-kv { display: flex; gap: 8px; padding: 2px 0; } .vz-kv .k { color: var(--tok-string); } .vz-kv .k::after { content: ':'; color: var(--text-2); }
.vz-empty, .vz-none { color: var(--text-2); font-size: 13px; }
.vz-ret { font-size: 13px; padding: 8px 10px; border-radius: 9px; background: var(--success-soft); color: var(--success); }
.vz-out { min-height: 56px; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--code-bg); border: 1px solid var(--border); font-size: 13px; white-space: pre-wrap; color: var(--code-text); }
.vz-errtxt { color: var(--error); }
.vz-err { margin: 16px; padding: 14px 16px; border-radius: 12px; background: var(--error-soft); border: 1px solid rgba(239,91,91,.4); }
.vz-err.small { margin: 0; }
.vz-err p { margin: 4px 0 8px; color: var(--text-2); font-size: 14px; } .vz-err code { font-size: 12.5px; }
.vz-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); }
.vz-ctrl input[type=range] { flex: 1; min-width: 120px; accent-color: var(--accent); }
.vz-count { font-size: 13px; color: var(--text-2); min-width: 130px; text-align: right; }
.vz-note { margin: 0; padding: 0 16px 12px; font-size: 12.5px; color: var(--warning); }
@media (max-width: 800px) {
  .vz-grid { grid-template-columns: 1fr; }
  .vz-side { border-left: 0; border-top: 1px solid var(--border); }
  .vz-sub { display: none; }
  .vz-lines { font-size: 13px; }
  .vz-count { min-width: 0; width: 100%; text-align: center; }
  .hide-sm { display: none; }
}

/* Respect "reduce motion": show final states instantly */
@media (prefers-reduced-motion: reduce) {
  .tick-in, .case.tick-in .case-head .ok, .case.tick-in .case-head .bad, .ring, .home .xpbar > span, .home .week .wd, .home .tile, .goal-burst, .gb-ring, .gb-ring::after,
  .badge-pop.show .bp-e, .badge-pop.show .bp-shine, .path-anim::after, .path-anim > .level-card, .level-card.current .level-badge, .ld-rays, .ld-trophy, .ld-stats > div,
  .rf-inner, .podium .pod-bar, .podium .pod .avatar, .lb-list .lb-row, .cert-reveal, .cert-reveal *, .vz-ln.next .arrow::before, .vz-val.chg, .vz-frame, .xp-pill.bump, .bar > span { animation: none !important; }
  .rf-inner { transform: rotateY(180deg); }
}

/* Debugger (visualizer in debug mode) */
.vz-test { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 10px 16px 0; font-size: 13px; }
.vz-in code { font-size: 12.5px; }
.vz-verdict { margin: 10px 16px 0; padding: 12px 14px; border-radius: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; animation: tickIn .4s both; }
.vz-verdict b { font-size: 15px; } .vz-verdict span { color: var(--text-2); font-size: 14px; line-height: 1.5; }
.vz-verdict code { font-size: 12.5px; background: rgba(255,255,255,.06); padding: 1px 5px; border-radius: 5px; }
.vz-verdict.bad { background: var(--error-soft); border: 1px solid rgba(239,91,91,.4); } .vz-verdict.bad b { color: #FF8A8A; }
.vz-verdict.ok { background: var(--success-soft); border: 1px solid rgba(43,182,115,.4); } .vz-verdict.ok b { color: var(--success); }
.vz-verdict.warn { background: var(--warning-soft); border: 1px solid rgba(242,180,65,.4); } .vz-verdict.warn b { color: var(--warning); }
.vz-ln .n { background: none; border: 0; font: inherit; cursor: pointer; padding: 0; position: relative; }
.vz-ln .n:hover { color: var(--text); }
.vz-ln.bp .n { color: #fff; }
.vz-ln.bp .n::before { content: ''; position: absolute; right: -2px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: var(--error); z-index: -1; }
.vz-ln .n { z-index: 0; }
.lg-bp { background: var(--error); border-radius: 50% !important; }
.vz-ln.test-code code { opacity: .45; }
.vz-ln.culprit { box-shadow: inset 0 0 0 1px rgba(239,91,91,.35); }
.vz-ln.here { background: rgba(239,91,91,.18) !important; border-left-color: var(--error) !important; }
.vz-ln.here .arrow::before { content: '⚠' !important; color: var(--error) !important; }
.vz-cmp { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; font-size: 13px; }
.vz-cmp-h, .vz-cmp-r { display: grid; grid-template-columns: 22px 1fr 1fr; }
.vz-cmp-h { background: var(--raised-2); font-size: 10px; font-weight: 800; letter-spacing: .1em; color: var(--text-2); }
.vz-cmp-h span, .vz-cmp-r > * { padding: 5px 8px; min-width: 0; }
.vz-cmp-r + .vz-cmp-r, .vz-cmp-h + .vz-cmp-r { border-top: 1px solid var(--border-soft); }
.vz-cmp-r code { background: none; white-space: pre; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.vz-cmp-r code + code { border-left: 1px solid var(--border-soft); color: var(--text-2); }
.vz-cmp-r .ic { text-align: center; font-weight: 800; }
.vz-cmp-r.ok .ic { color: var(--success); } .vz-cmp-r.ok { background: rgba(43,182,115,.06); }
.vz-cmp-r.bad, .vz-cmp-r.extra, .vz-cmp-r.missing { background: rgba(239,91,91,.1); } .vz-cmp-r.bad .ic, .vz-cmp-r.extra .ic, .vz-cmp-r.missing .ic { color: var(--error); }
.vz-cmp-r.pending { color: var(--text-2); } .vz-cmp-r.pending code:first-of-type { opacity: .5; }
.vz-cmp-r i { color: var(--muted, var(--text-2)); font-style: normal; }
.vz-cmp + .vz-errtxt, #vzCmp .vz-errtxt { margin-top: 8px; font-family: "JetBrains Mono", monospace; font-size: 12.5px; }
.case-debug { margin-left: auto; padding: 3px 10px; font-size: 12.5px; }
@media (prefers-reduced-motion: reduce) { .vz-verdict { animation: none; } }
@media (max-width: 800px) { .vz-grid { flex: none; } .vz-code, .vz-side { overflow: visible; } .vz-verdict { margin: 10px 12px 0; } }
.vz-var { min-width: 0; } .vz-val { max-width: 100%; overflow-wrap: anywhere; }
.vz-obj .vz-kv .k { color: var(--tok-def); } .vz-obj .vz-kv .k::before { content: '.'; color: var(--text-2); }

/* Debug: test picker + own input */
.vz-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--raised); }
.vz-pick-l { font-size: 12px; font-weight: 700; color: var(--text-2); margin-right: 2px; }
.vz-chip { border: 1px solid var(--border); background: var(--raised-2); color: var(--text-2); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.vz-chip:hover { color: var(--text); border-color: var(--accent); }
.vz-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.vz-custom { flex-basis: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 6px; animation: tickIn .25s both; }
.vz-custom[hidden] { display: none; }
.vz-custom textarea { width: 100%; resize: vertical; min-height: 64px; font-family: "JetBrains Mono", monospace; font-size: 13px; background: var(--code-bg); color: var(--code-text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.vz-custom textarea:focus { outline: none; border-color: var(--accent); }
.vz-custom-r { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.vz-custom-r .btn { flex: none; }
@media (max-width: 800px) { .vz-custom-r { flex-direction: column; align-items: stretch; } }

/* =================== 3D hero: giant word behind, 3D block + glass cards in front =================== */
.d3-hero { flex-direction: column; justify-content: flex-start; padding-top: 18px; gap: 0; }
.d3-stage { position: relative; width: 100%; height: clamp(300px, 52vh, 520px); display: grid; place-items: center; }
.d3-word { position: absolute; left: 50%; top: 50%; margin: 0; translate: -50% -54%; font-size: clamp(96px, 23vw, 360px); font-weight: 900; letter-spacing: -.06em; line-height: .8; white-space: nowrap; user-select: none; pointer-events: none;
  background: linear-gradient(180deg, rgba(237,237,240,.95) 0%, rgba(237,237,240,.55) 45%, rgba(79,124,255,.10) 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  opacity: 0; animation: wordIn 1.2s .1s cubic-bezier(.2,.7,.2,1) forwards; will-change: transform; }
@keyframes wordIn { from { opacity: 0; letter-spacing: .1em; filter: blur(12px); } to { opacity: 1; } }
[data-theme="light"] .d3-word { background: linear-gradient(180deg, rgba(24,32,51,.9), rgba(24,32,51,.08)); -webkit-background-clip: text; background-clip: text; }
.d3-scene { position: relative; width: clamp(240px, 34vw, 420px); aspect-ratio: 1; perspective: 1100px; opacity: 0; animation: ctIn 1s .45s cubic-bezier(.2,.7,.2,1) forwards; }
.d3-rig { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform; }
.d3-shadow { position: absolute; left: 18%; right: 18%; bottom: 4%; height: 12%; border-radius: 50%; background: radial-gradient(closest-side, rgba(0,0,0,.75), transparent); filter: blur(6px); transform: translateZ(-80px) rotateX(80deg); }

/* The block: 14 stacked layers give it real thickness; the front face is glossy */
.d3-logo { position: absolute; left: 50%; top: 50%; width: 52%; aspect-ratio: 1; margin: -26% 0 0 -26%; transform-style: preserve-3d; transform: translateZ(40px); }
.d3-float { position: absolute; inset: 0; transform-style: preserve-3d; animation: d3Float 6s ease-in-out infinite; }
@keyframes d3Float { 0%, 100% { transform: translateY(-6px) rotateY(-24deg) rotateX(8deg); } 50% { transform: translateY(8px) rotateY(24deg) rotateX(-6deg); } }
.d3-layer { position: absolute; inset: 0; border-radius: 24%; background: linear-gradient(135deg, #2a4fd6, #1a2f8f); transform: translateZ(var(--z)); }
.d3-layer:last-of-type { box-shadow: 0 30px 60px rgba(0,0,0,.55), 0 0 80px rgba(79,124,255,.35); }
.d3-face { position: absolute; inset: 0; border-radius: 24%; overflow: hidden; display: grid; place-items: center; transform: translateZ(1px);
  background: radial-gradient(120% 90% at 30% 15%, #8fb0ff 0%, #4f7cff 38%, #3a5fe6 70%, #2b46c4 100%); box-shadow: inset 0 2px 0 rgba(255,255,255,.45), inset 0 -10px 24px rgba(0,0,40,.35); }
.d3-face svg { width: 64%; height: 64%; filter: drop-shadow(0 6px 10px rgba(0,0,60,.45)); }
.d3-sheen { position: absolute; inset: -40%; background: radial-gradient(closest-side, rgba(255,255,255,.55), transparent 70%); transform: translate(var(--shx, 0%), var(--shy, 0%)); mix-blend-mode: soft-light; transition: transform .2s; }

/* Glass cards floating at different depths */
.d3-card { position: absolute; transform-style: preserve-3d; }
.dc-in { background: rgba(19,19,24,.62); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: 10px 12px; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 20px 50px rgba(0,0,0,.45); color: var(--text); font-size: clamp(11px, 1.1vw, 15px); animation: cardBob 5s ease-in-out infinite; white-space: nowrap; }
@keyframes cardBob { 50% { transform: translateY(-8px); } }
.dc1 { left: -34%; top: 8%; transform: translateZ(110px) rotateY(18deg); }
.dc1 .dc-in { animation-delay: -1.2s; }
.dc1 pre { margin: 6px 0 0; font-family: "JetBrains Mono", monospace; font-size: 1em; line-height: 1.55; }
.dc-bar { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: .85em; }
.dc-bar .dots { display: flex; gap: 4px; } .dc-bar .dots i { width: 7px; height: 7px; border-radius: 50%; background: #3a3a44; }
.dc2 { right: -30%; top: 22%; transform: translateZ(150px) rotateY(-16deg); }
.dc2 .dc-in { display: flex; flex-direction: column; gap: 2px; border-color: rgba(43,182,115,.45); animation-delay: -2.6s; }
.dc2 b { color: #4FD796; } .dc2 small { color: var(--warning); font-weight: 700; }
.dc3 { right: -14%; bottom: 2%; transform: translateZ(80px) rotateY(-10deg); }
.dc3 .dc-in { display: flex; align-items: baseline; gap: 6px; border-color: rgba(242,180,65,.45); animation-delay: -3.8s; }
.dc3 b { font-size: 1.9em; line-height: 1; } .dc3 small { color: var(--text-2); } .dc-flame { font-size: 1.4em; align-self: center; }

.d3-copy { margin-top: 6px; }
.d3-title { font-size: clamp(34px, 5.4vw, 72px); margin-top: 16px; }
.d3-title .ct-line { display: block; }

@media (max-width: 700px) {
  .d3-stage { height: 300px; }
  .d3-scene { width: 220px; }
  .dc1 { left: -26%; top: -8%; } .dc2 { right: -30%; top: 34%; } .dc3 { right: -6%; bottom: -4%; }
  .dc-in { font-size: 10px; padding: 7px 9px; border-radius: 11px; }
  .d3-title { font-size: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .d3-word, .d3-scene { animation: none; opacity: 1; }
  .d3-float, .dc-in { animation: none; }
}

/* =================== Fly-in 3D block (plays once, then stays) =================== */
.mini-block { position: relative; width: 64px; aspect-ratio: 1; margin: 0 auto 16px; transform-style: preserve-3d; animation: mbFly 1.6s cubic-bezier(.2,.75,.25,1) both; }
.mini-block .mb-float { position: absolute; inset: 0; transform-style: preserve-3d; animation: mbBob 5s 1.6s ease-in-out infinite; }
.mini-block .d3-layer, .mini-block .d3-face { border-radius: 26%; }
.mini-block .d3-face svg { width: 62%; height: 62%; }
.mini-block .d3-layer:last-of-type { box-shadow: 0 18px 34px rgba(0,0,0,.5), 0 0 40px rgba(79,124,255,.35); }
@keyframes mbFly {
  0% { opacity: 0; transform: perspective(700px) translate3d(0, -30px, -2600px) rotateY(-720deg) rotateX(55deg); }
  55% { opacity: 1; transform: perspective(700px) translate3d(0, 0, 190px) rotateY(18deg) rotateX(-12deg); }
  78% { opacity: 1; transform: perspective(700px) translateZ(-18px) rotateY(-8deg) rotateX(4deg); }
  100% { opacity: 1; transform: perspective(700px) translateZ(0) rotateY(-14deg) rotateX(8deg); }
}
@keyframes mbBob { 50% { transform: translateY(-5px) rotateY(22deg); } }
.mb-sm { width: 54px; margin: 0 0 14px; }
.mb-cele { width: 92px; margin-bottom: 18px; }
/* Price card: the block waits off-screen, then flies in when the section scrolls into view */
.price-card { position: relative; }
.mb-price { position: absolute; top: -34px; right: 28px; width: 76px; margin: 0; z-index: 2; animation: none; opacity: 0; }
#pricing.in .mb-price { animation: mbFly 1.6s .25s cubic-bezier(.2,.75,.25,1) both; }

/* =================== Account pages (log in, sign up, reset, unlock) =================== */
.pub-main.auth { position: relative; }
.auth-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.auth-bg .cine-glow.g1 { left: -10vw; top: -10vw; } .auth-bg .cine-glow.g2 { right: -12vw; bottom: -16vw; }
.auth-wrap { align-items: center; min-height: calc(100vh - 160px); min-height: calc(100svh - 160px); }
.auth-card { position: relative; background: color-mix(in srgb, var(--raised) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 30px 80px rgba(0,0,0,.35); animation: tickIn .6s .1s cubic-bezier(.2,.8,.3,1) both; }
.auth-card h1 { letter-spacing: -.02em; }
.auth-card .field input { transition: border-color .15s, box-shadow .15s; }
.auth-card .field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); outline: none; }
.auth-card .btn-primary.btn-block { position: relative; overflow: hidden; }
.auth-card .btn-primary.btn-block::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%); transform: translateX(-120%); animation: btnShine 3.2s 1.8s ease-in-out infinite; }
@keyframes btnShine { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.auth-side { animation: tickIn .6s .3s cubic-bezier(.2,.8,.3,1) both; }
.auth-art { width: 340px; align-self: center; }
.auth-art .mini-block { width: 110px; margin: 0 0 26px 6px; animation-delay: .2s; }
.auth-art h2 { font-size: 34px; line-height: 1.1; letter-spacing: -.02em; margin: 0 0 18px; }
.serif { font-family: "Instrument Serif", Georgia, "Times New Roman", serif; font-style: italic; font-weight: 400; letter-spacing: 0; }
.auth-preview { border-style: solid; background: linear-gradient(160deg, var(--accent-soft), transparent 60%), var(--raised); box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.ap-k { font-size: 10px; letter-spacing: .16em; color: var(--text-2); font-weight: 800; }
.ap-rank { color: var(--text-2); font-size: 14px; }
.ap-bar { width: 80%; height: 6px; border-radius: 6px; background: var(--raised-2); overflow: hidden; } .ap-bar i { display: block; width: 6%; height: 100%; background: linear-gradient(90deg, var(--accent), #8F6BFF); }
.ap-stats { display: flex; gap: 14px; font-size: 13px; color: var(--text-2); margin-top: 4px; }
.pop-in { animation: popIn .45s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes popIn { from { transform: scale(.5); opacity: 0; } }

/* =================== Profile photo =================== */
.avatar.photo { background: #222 center / cover no-repeat; }
.ph-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ph-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ph-scrim { position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.7); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .2s; }
.ph-scrim.show { opacity: 1; }
.ph-box { width: min(420px, 100%); padding: 22px; text-align: center; animation: tickIn .3s both; }
.ph-box h3 { margin: 0 0 4px; font-size: 19px; }
.ph-cam, .ph-crop { position: relative; width: min(300px, 76vw); aspect-ratio: 1; margin: 14px auto; border-radius: 18px; overflow: hidden; background: #000; }
.ph-cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.ph-crop canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.ph-crop canvas:active { cursor: grabbing; }
.ph-ring { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at center, transparent 0 69%, rgba(0,0,0,.55) 70%); box-shadow: inset 0 0 0 2px rgba(255,255,255,.08); }
.ph-ring::after { content: ''; position: absolute; inset: 0; margin: auto; width: 140%; height: 140%; border-radius: 50%; }
.ph-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; color: #ddd; font-size: 14px; }
.ph-zoom { display: flex; align-items: center; gap: 10px; margin: 0 auto 12px; width: min(300px, 76vw); }
.ph-zoom input { flex: 1; accent-color: var(--accent); }
.ph-actions { display: flex; gap: 10px; justify-content: center; }

@media (max-width: 760px) {
  .auth-wrap { min-height: 0; }
  .mb-price { right: 16px; top: -28px; width: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  .mini-block, .mini-block .mb-float, #pricing.in .mb-price, .auth-card, .auth-side, .auth-card .btn-primary.btn-block::after, .pop-in, .ph-box { animation: none !important; opacity: 1 !important; }
}

/* =================== Home dashboard (redesign) =================== */
.home2 { max-width: 1180px; }
.hh-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; padding: 30px 32px; border-radius: 24px; border: 1px solid var(--border); background: var(--raised); margin-bottom: 22px; animation: tickIn .5s both; }
.hh-bg { position: absolute; inset: 0; pointer-events: none; }
.hh-bg i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.hh-bg .g1 { width: 380px; height: 380px; left: -120px; top: -160px; background: radial-gradient(circle, rgba(79,124,255,.6), transparent 65%); animation: glowDrift 12s ease-in-out infinite alternate; }
.hh-bg .g2 { width: 340px; height: 340px; right: -100px; bottom: -180px; background: radial-gradient(circle, rgba(143,107,255,.5), transparent 65%); animation: glowDrift 14s -5s ease-in-out infinite alternate; }
.hh-me { position: relative; display: flex; align-items: center; gap: 20px; min-width: 0; }
.hh-greet { color: var(--text-2); font-size: 15px; }
.hh-name { font-size: clamp(34px, 4vw, 52px); line-height: 1.05; letter-spacing: -.02em; margin: 2px 0 10px; }
.hh-name .serif { font-weight: 400; }
.hh-rank { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hh-continue { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 22px; border-radius: 18px; color: var(--text); background: linear-gradient(135deg, rgba(79,124,255,.24), rgba(143,107,255,.12) 60%, transparent), color-mix(in srgb, var(--raised-2) 70%, transparent); border: 1px solid rgba(79,124,255,.4); transition: transform .2s, box-shadow .2s, border-color .2s; }
.hh-continue:hover { color: var(--text); transform: translateY(-3px); box-shadow: 0 18px 40px rgba(79,124,255,.2); border-color: var(--accent); }
.hh-ct { font-size: 21px; line-height: 1.25; }
.hh-lvl { font-size: 13px; color: var(--text-2); }
.hh-lbar { width: 100%; height: 6px; border-radius: 6px; background: var(--raised-2); overflow: hidden; margin: 4px 0 8px; }
.hh-lbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--success), var(--accent)); border-radius: 6px; animation: growW 1s .3s cubic-bezier(.3,.7,.2,1) both; }
.hh-continue .btn { margin-top: 2px; }

.hh-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.hh-stat { display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 18px; animation: tickIn .45s both; }
.hh-stat:nth-child(2) { animation-delay: .05s; } .hh-stat:nth-child(3) { animation-delay: .1s; } .hh-stat:nth-child(4) { animation-delay: .15s; }
.hh-stat small { display: block; font-size: 11.5px; letter-spacing: .08em; color: var(--text-2); font-weight: 700; text-transform: uppercase; }
.hh-stat .hs-top { display: flex; align-items: center; gap: 12px; }
.hh-stat .big-n { font-size: 30px; letter-spacing: -.02em; line-height: 1; }
.hh-stat .flame { font-size: 34px; }
.hs-ic { font-size: 30px; }
.hs-goal, .hs-course { flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; }
.hs-goal b, .hs-course b { display: block; font-size: 17px; margin: 2px 0; }
.hh-stat .week { display: flex; gap: 5px; } .hh-stat .wd { width: 24px; height: 24px; font-size: 10px; border-radius: 7px; }
.hh-stat p { margin: 0; }

.hh-two { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-bottom: 40px; }
.hh-next { padding: 20px; animation: tickIn .45s .2s both; }
.hh-next .sec-head { margin-bottom: 10px; }
.hn-row { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 12px; color: var(--text); transition: background .15s, transform .15s; animation: tickIn .4s both; animation-delay: calc(.3s + var(--i) * 80ms); }
.hn-row + .hn-row { border-top: 1px solid var(--border-soft); }
.hn-row:hover { background: var(--raised-2); color: var(--text); transform: translateX(3px); }
.hn-row b { display: block; font-size: 15px; } .hn-row small { color: var(--text-2); font-size: 12.5px; }
.hn-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.hn-ic.practice { background: var(--success-soft); color: var(--success); } .hn-ic.challenge { background: var(--warning-soft); color: var(--warning); }
.hh-word { padding: 20px; display: flex; flex-direction: column; gap: 6px; background: linear-gradient(160deg, rgba(242,180,65,.10), transparent 55%), var(--raised); animation: tickIn .45s .25s both; }
.hw-term { font-family: "JetBrains Mono", monospace; font-size: 24px; color: var(--tok-def); }
.hh-word p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.hw-ex { margin: 4px 0; padding: 10px 12px; border-radius: 10px; background: var(--code-bg); border: 1px solid var(--border); font-size: 13px; overflow-x: auto; }
.hh-word a { margin-top: auto; }

/* Journey strip */
.jr-strip { display: flex; gap: 12px; overflow-x: auto; padding: 26px 4px 14px; scroll-behavior: smooth; scrollbar-width: thin; position: relative; }
.jr-node { position: relative; flex: none; width: 150px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 16px 10px 12px; border-radius: 16px; border: 1px solid var(--border); background: var(--raised); color: var(--text); transition: transform .15s, border-color .15s; animation: tickIn .4s both; }
a.jr-node:hover { transform: translateY(-3px); border-color: var(--accent); color: var(--text); }
.jr-node.locked { opacity: .45; }
.jr-dot { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-weight: 800; background: var(--raised-2); color: var(--text-2); }
.jr-node.done .jr-dot { background: var(--success); color: #fff; box-shadow: 0 0 14px rgba(43,182,115,.4); }
.jr-node.current { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--raised); box-shadow: 0 0 0 1px var(--accent), 0 10px 30px rgba(79,124,255,.2); }
.jr-node.current .jr-dot { background: var(--accent); color: #fff; animation: curPulse 2s ease-out infinite; }
.jr-here { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 800; letter-spacing: .04em; padding: 3px 9px; border-radius: 99px; background: var(--accent); color: #fff; }
.jr-title { font-size: 13px; font-weight: 700; line-height: 1.25; min-height: 2.5em; }
.jr-bar { width: 80%; height: 4px; border-radius: 4px; background: var(--raised-2); overflow: hidden; } .jr-bar i { display: block; height: 100%; background: var(--success); }

@media (max-width: 1000px) {
  .hh-hero { grid-template-columns: 1fr; }
  .hh-stats { grid-template-columns: repeat(2, 1fr); }
  .hh-two { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .hh-hero { padding: 20px 16px; border-radius: 18px; gap: 18px; }
  .hh-me { gap: 14px; } .hh-me .avatar { width: 58px !important; height: 58px !important; font-size: 32px !important; }
  .hh-name { font-size: 32px; }
  .hh-stats { gap: 10px; } .hh-stat { padding: 14px; gap: 8px; }
  .hs-goal, .hs-course { flex-direction: column; align-items: flex-start; }
  .hh-stat .wd { width: 20px; height: 20px; }
  .jr-node { width: 128px; }
}

/* =================== First-day welcome =================== */
.ob-scrim { position: fixed; inset: 0; z-index: 350; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 30% 20%, rgba(79,124,255,.25), transparent 50%), radial-gradient(circle at 80% 90%, rgba(143,107,255,.22), transparent 50%), rgba(0,0,0,.86); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: 0; transition: opacity .35s; }
.ob-scrim.show { opacity: 1; } .ob-scrim.out { opacity: 0; }
.ob-box { position: relative; width: min(620px, 100%); max-height: calc(100vh - 32px); max-height: calc(100svh - 32px); overflow-y: auto; padding: 34px 32px 30px; border-radius: 26px; background: color-mix(in srgb, var(--raised) 92%, transparent); border: 1px solid var(--border); box-shadow: 0 40px 100px rgba(0,0,0,.6); text-align: center; }
.ob-skip { position: absolute; top: 16px; right: 18px; background: none; border: 0; color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; }
.ob-skip:hover { color: var(--text); }
.ob-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 22px; }
.ob-dots i { width: 8px; height: 8px; border-radius: 8px; background: var(--raised-2); transition: width .3s, background .3s; }
.ob-dots i.past { background: var(--accent-soft); } .ob-dots i.on { width: 26px; background: var(--accent); }
.ob-step { display: flex; flex-direction: column; align-items: center; gap: 14px; animation: obIn .5s cubic-bezier(.2,.8,.3,1) both; }
@keyframes obIn { from { opacity: 0; transform: translateX(30px); } }
.ob-step h2 { font-size: clamp(28px, 4.4vw, 40px); line-height: 1.1; letter-spacing: -.02em; margin: 0; }
.ob-step h2 .serif { font-weight: 400; }
.ob-step p { color: var(--text-2); margin: 0; max-width: 440px; line-height: 1.55; }
.ob-step .btn-lg { margin-top: 8px; }
.ob-hero { animation: trophyDrop .9s cubic-bezier(.3,1.6,.5,1) both; }
.ob-path { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0; }
.ob-node { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 66px; animation: tickIn .4s both; animation-delay: calc(var(--i) * 90ms); }
.ob-node b { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--raised-2); font-size: 14px; }
.ob-node small { font-size: 10px; color: var(--text-2); line-height: 1.2; }
.ob-node.here b { background: var(--accent); color: #fff; animation: curPulse 2s ease-out infinite; }
.ob-node.more b { width: auto; padding: 0 10px; color: var(--text-2); }
.ob-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.ob-nums > div { padding: 12px 6px; border-radius: 14px; background: var(--raised-2); display: flex; flex-direction: column; }
.ob-nums b { font-size: 28px; letter-spacing: -.02em; } .ob-nums span { font-size: 12px; color: var(--text-2); }
.ob-goals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.ob-goal { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 8px; border-radius: 16px; border: 2px solid var(--border); background: var(--raised-2); color: var(--text); font: inherit; cursor: pointer; transition: transform .15s, border-color .15s; }
.ob-goal:hover { transform: translateY(-2px); }
.ob-goal.on { border-color: var(--accent); background: var(--accent-soft); }
.ob-goal span { font-size: 30px; } .ob-goal b { font-size: 16px; } .ob-goal small { font-size: 12px; color: var(--text-2); }
.ob-ed { width: 100%; padding: 0; overflow: hidden; text-align: left; }
.ob-ed-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.ob-ed-bar .dots { display: flex; gap: 5px; } .ob-ed-bar .dots i { width: 9px; height: 9px; border-radius: 50%; background: #3a3a44; }
.ob-ed .CodeMirror { height: auto; font-size: 16px; }
.ob-ed-run { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); }
.ob-out { margin: 0; min-height: 44px; padding: 10px 14px; background: var(--code-bg); color: var(--code-text); font-size: 15px; white-space: pre-wrap; }
.ob-out.err { color: #FF8A8A; }
.ob-tips { display: flex; flex-direction: column; gap: 10px; width: 100%; text-align: left; }
.ob-tip { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 16px; background: var(--raised-2); animation: tickIn .4s both; animation-delay: calc(var(--i) * 120ms); }
.ob-tip > span { font-size: 28px; } .ob-tip b { font-size: 15px; } .ob-tip p { margin: 2px 0 0; font-size: 13.5px; }
@media (max-width: 600px) {
  .ob-box { padding: 28px 18px 22px; border-radius: 22px; }
  .ob-node { width: 56px; } .ob-nums b { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .hh-hero, .hh-stat, .hh-next, .hn-row, .hh-word, .jr-node, .jr-node.current .jr-dot, .hh-lbar i, .hh-bg i, .ob-step, .ob-hero, .ob-node, .ob-tip, .ob-node.here b { animation: none !important; }
}
.hh-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hh-stat .week { flex-wrap: wrap; }
@media (max-width: 1000px) { .hh-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* =================== 3D tilt + spotlight (cards with class "tilt", mouse only) =================== */
.tilt { position: relative; transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .5s cubic-bezier(.2,.8,.3,1), border-color .2s, box-shadow .3s; transform-style: preserve-3d; }
.tilt.tilting { transition: transform .08s linear, border-color .2s, box-shadow .3s; box-shadow: 0 22px 50px rgba(0,0,0,.35); }
.tilt::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(79,124,255,.16), transparent 45%); }
.tilt.tilting::after { opacity: 1; }
.feat.tilt.tilting .feat-ic { transform: translateZ(30px) scale(1.06); }
.feat-ic { transition: transform .3s; }

/* =================== Moving keyword band =================== */
.mq { margin-top: 10px; padding: 26px 0; overflow: hidden; display: flex; flex-direction: column; gap: 14px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.mq-row { display: flex; overflow: hidden; }
.mq-track { display: flex; gap: 14px; flex: none; animation: mqMove 60s linear infinite; padding-right: 14px; }
.mq-row.rev .mq-track { animation-direction: reverse; animation-duration: 70s; }
.mq-track span { flex: none; font-family: "JetBrains Mono", monospace; font-size: 15px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--raised); color: var(--text-2); white-space: nowrap; }
.mq-row:not(.rev) .mq-track span:nth-child(3n) { color: var(--tok-builtin); border-color: rgba(111,195,255,.3); }
.mq-row.rev .mq-track span:nth-child(4n) { color: var(--tok-keyword); border-color: rgba(199,146,234,.3); }
.mq-row .mq-track span:nth-child(5n) { color: var(--tok-string); border-color: rgba(165,217,135,.3); }
@keyframes mqMove { to { transform: translateX(-50%); } }

/* =================== Big rolling numbers =================== */
.big-stats { background: none; border: 0; padding: 30px 0; }
.big-stats b { font-size: clamp(52px, 7vw, 96px) !important; line-height: 1; letter-spacing: -.04em; background: linear-gradient(180deg, var(--text), color-mix(in srgb, var(--accent) 70%, var(--text))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.big-stats > div > span { font-size: 15px !important; }
.odo span { font-size: inherit !important; line-height: 1 !important; }
.odo { display: inline-flex; overflow: hidden; height: 1em; line-height: 1; vertical-align: bottom; }
.odo-col { display: inline-block; height: 1em; overflow: hidden; }
.odo-strip { display: flex; flex-direction: column; transform: translateY(0); transition: transform 1.6s cubic-bezier(.2,.9,.25,1); transition-delay: calc(var(--i) * 120ms); }
.odo-strip > span { height: 1em; display: block; line-height: 1; }
.odo.roll .odo-strip { transform: translateY(calc(var(--d) * -1em)); }
.big-stats .odo-strip > span { background: inherit; -webkit-background-clip: text; background-clip: text; }
.big-stats .odo, .big-stats .odo * { color: var(--text); -webkit-text-fill-color: currentColor; }

/* =================== Curriculum: a glowing line draws as you scroll =================== */
.cur-list { position: relative; padding-left: 22px; }
.cur-list::before, .cur-list::after { content: ''; position: absolute; left: 6px; top: 8px; width: 2px; border-radius: 2px; }
.cur-list::before { bottom: 8px; background: var(--border); }
.cur-list::after { height: calc((100% - 16px) * var(--draw, 0)); background: linear-gradient(var(--accent), var(--success)); box-shadow: 0 0 12px rgba(79,124,255,.7); transition: height .15s linear; }

/* =================== Ending: aurora + live terminal =================== */
.outro { position: relative; margin-top: 100px; padding: 110px 20px 120px; overflow: hidden; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 30px; }
.aurora { position: absolute; inset: 0; pointer-events: none; filter: blur(60px) saturate(1.2); opacity: .7; }
.aurora i { position: absolute; width: 60vw; height: 40vw; border-radius: 50%; mix-blend-mode: screen; }
.aurora i:nth-child(1) { left: -10vw; top: 10%; background: radial-gradient(closest-side, rgba(79,124,255,.55), transparent); animation: aur1 16s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { right: -12vw; top: 0; background: radial-gradient(closest-side, rgba(43,182,115,.4), transparent); animation: aur2 19s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { left: 25%; bottom: -20%; background: radial-gradient(closest-side, rgba(199,146,234,.45), transparent); animation: aur1 22s -6s ease-in-out infinite alternate-reverse; }
@keyframes aur1 { to { transform: translate(18vw, -6vw) scale(1.2); } }
@keyframes aur2 { to { transform: translate(-20vw, 8vw) scale(.9); } }
.outro-h { position: relative; font-size: clamp(36px, 5.6vw, 72px); line-height: 1.04; letter-spacing: -.03em; margin: 0; }
.outro-h .serif { font-weight: 400; }
.pp-term { position: relative; width: min(640px, 100%); padding: 0; overflow: hidden; text-align: left; background: rgba(8,8,10,.82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.pp-term-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); font-size: 12.5px; font-family: "JetBrains Mono", monospace; }
.pp-term-bar .dots { display: flex; gap: 6px; } .pp-term-bar .dots i { width: 10px; height: 10px; border-radius: 50%; background: #3a3a44; }
.pp-term-bar .dots i:nth-child(1) { background: #ff5f57; } .pp-term-bar .dots i:nth-child(2) { background: #febc2e; } .pp-term-bar .dots i:nth-child(3) { background: #28c840; }
.pp-term-body { margin: 0; min-height: 190px; padding: 16px 18px; font-family: "JetBrains Mono", monospace; font-size: clamp(12px, 1.5vw, 15px); line-height: 1.75; color: #D7DEEE; white-space: pre-wrap; }
.t-in { color: var(--tok-keyword); } .t-out { color: #A6A6B0; } .t-ok { color: #4FD796; font-weight: 600; }
.outro-cta { position: relative; opacity: .75; transition: opacity .6s, transform .6s; transform: translateY(6px); }
.outro.done .outro-cta { opacity: 1; transform: none; }
.outro.done .outro-cta .btn { animation: ctaPulse 2.4s ease-in-out 3; }
@keyframes ctaPulse { 50% { box-shadow: 0 0 0 10px rgba(79,124,255,.18), 0 0 40px rgba(79,124,255,.5); } }

/* =================== Home: live sky banner =================== */
.hh-hero { isolation: isolate; border: 0; }
.sky { position: absolute; inset: 0; z-index: -1; overflow: hidden; transition: background 1s; }
.sky-morning .sky { background: linear-gradient(180deg, #2a1f4a 0%, #8a4f7d 45%, #f0a06b 100%); }
.sky-day .sky { background: linear-gradient(180deg, #0e2a5c 0%, #2c62c9 55%, #67a8f2 100%); }
.sky-evening .sky { background: linear-gradient(180deg, #1b1538 0%, #6b2f6b 50%, #ff8a4c 100%); }
.sky-night .sky { background: linear-gradient(180deg, #03040c 0%, #0b1030 60%, #1a1446 100%); }
.sky::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.55), rgba(0,0,0,.15) 55%, rgba(0,0,0,.35)); }
.sky .sun, .sky .moon { position: absolute; border-radius: 50%; display: none; }
.sky .sun { width: 120px; height: 120px; right: 30%; bottom: -30px; background: radial-gradient(circle, #fff3c4, #ffc164 50%, rgba(255,160,80,0) 70%); box-shadow: 0 0 80px 30px rgba(255,180,90,.45); animation: sunRise 2.4s cubic-bezier(.2,.8,.3,1) both; }
.sky-day .sun { right: 22%; top: 20px; bottom: auto; width: 90px; height: 90px; }
.sky-morning .sun, .sky-day .sun, .sky-evening .sun { display: block; }
.sky-evening .sun { bottom: -50px; background: radial-gradient(circle, #ffe0b0, #ff7a3d 55%, rgba(255,90,40,0) 72%); }
@keyframes sunRise { from { transform: translateY(70px); opacity: 0; } }
.sky-night .moon { display: block; width: 64px; height: 64px; right: 28%; top: 26px; background: radial-gradient(circle at 35% 35%, #fffbe6, #d9d4c0 60%); box-shadow: 0 0 40px 10px rgba(255,250,220,.25); animation: sunRise 2s both; }
.sky-night .moon::after { content: ''; position: absolute; width: 100%; height: 100%; border-radius: 50%; left: 18px; top: -8px; background: #0b1030; }
.stars { position: absolute; inset: 0; display: none; }
.sky-night .stars, .sky-morning .stars { display: block; }
.sky-morning .stars { opacity: .35; }
.stars i { position: absolute; left: var(--x); top: var(--y); width: 2px; height: 2px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px #fff; animation: twinkle 2.8s var(--d) ease-in-out infinite; }
.stars i:nth-child(3n) { width: 3px; height: 3px; }
@keyframes twinkle { 50% { opacity: .2; transform: scale(.6); } }
.cloud { position: absolute; height: 34px; border-radius: 40px; background: rgba(255,255,255,.55); filter: blur(3px); display: none; }
.cloud::before, .cloud::after { content: ''; position: absolute; border-radius: 50%; background: inherit; }
.cloud::before { width: 44px; height: 44px; left: 18px; top: -22px; } .cloud::after { width: 60px; height: 60px; left: 48px; top: -32px; }
.sky-day .cloud, .sky-morning .cloud { display: block; }
.sky-morning .cloud { background: rgba(255,210,220,.35); }
.cloud.c1 { width: 140px; top: 46px; left: -160px; animation: drift 46s linear infinite; }
.cloud.c2 { width: 110px; top: 110px; left: -160px; animation: drift 62s -24s linear infinite; opacity: .7; }
@keyframes drift { to { transform: translateX(calc(100vw + 340px)); } }
.hh-hero .hh-greet, .hh-hero .hh-name, .hh-hero .muted { color: #fff; text-shadow: 0 2px 20px rgba(0,0,0,.35); }
.hh-hero .hh-greet { opacity: .85; }
.hh-hero .rank-chip { background: rgba(255,255,255,.16); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.hh-hero .xpbar { background: rgba(255,255,255,.18); }
.hh-hero .hh-continue { background: rgba(12,12,18,.55); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-color: rgba(255,255,255,.18); }
[data-theme="light"] .hh-hero .hh-continue { color: #fff; }
[data-theme="light"] .hh-hero .hh-continue .hh-lvl { color: rgba(255,255,255,.75); }

/* Home details: glowing gradient rings, flame size, journey line */
.home2 .ring { background: conic-gradient(from -90deg, var(--accent), #8F6BFF calc(var(--p) * .6%), var(--success) calc(var(--p) * 1%), var(--raised-2) 0); filter: drop-shadow(0 0 10px rgba(79,124,255,.25)); }
.home2 .flame { display: inline-block; transform: scale(var(--fl, 1)); transform-origin: bottom center; }
.home2 .flame.lit { animation: flickerBig 1.8s infinite; }
@keyframes flickerBig { 50% { transform: scale(calc(var(--fl, 1) * 1.08)) rotate(-4deg); filter: drop-shadow(0 0 10px rgba(255,120,40,.7)); } }
.home2 .big-n.odo { height: 1em; }
.jr-strip::before, .jr-strip::after { content: ''; position: absolute; top: 63px; left: 80px; height: 2px; border-radius: 2px; pointer-events: none; }
.jr-strip::before { width: calc(var(--jr-w, 3300px)); background: var(--border); }
.jr-strip::after { width: calc(var(--jr, 0px) - 80px); background: linear-gradient(90deg, var(--success), var(--accent)); box-shadow: 0 0 10px rgba(79,124,255,.6); animation: jrDraw 1.4s .3s cubic-bezier(.3,.7,.2,1) both; }
@keyframes jrDraw { from { width: 0; } }
.jr-node { z-index: 1; }

@media (max-width: 700px) {
  .mq-track span { font-size: 13px; padding: 8px 12px; }
  .outro { padding: 80px 16px 90px; margin-top: 70px; }
  .sky .sun { right: 8%; } .sky-night .moon { right: 10%; }
  .jr-strip::before, .jr-strip::after { top: 63px; left: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  .mq-track, .aurora i, .stars i, .cloud, .sky .sun, .sky-night .moon, .home2 .flame.lit, .jr-strip::after, .outro.done .outro-cta .btn { animation: none !important; }
  .odo-strip { transition: none; }
  .outro-cta { opacity: 1; transform: none; }
}
/* Home: the learner's name — bold, big, written in, with a waving hand */
.hh-name { font-size: clamp(40px, 5vw, 64px) !important; font-weight: 800; letter-spacing: -.035em; line-height: 1.02; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hh-nm { background: linear-gradient(100deg, #ffffff 0%, #ffffff 45%, #ffe3a3 70%, #ffffff 100%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 4px 18px rgba(0,0,0,.35)); padding-bottom: .06em;
  animation: nmWrite 1s .15s cubic-bezier(.3,.7,.2,1) both, nmShine 6s 1.4s ease-in-out infinite; }
@keyframes nmWrite { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes nmShine { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0% 0; } }
.hh-wave { display: inline-block; font-size: .8em; transform-origin: 70% 75%; animation: wave 1.8s 1.1s ease-in-out 2; text-shadow: none; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-10deg); } 50% { transform: rotate(10deg); } }
[data-theme="light"] .hh-nm { background-image: linear-gradient(100deg, #ffffff 0%, #ffffff 45%, #ffe3a3 70%, #ffffff 100%); }
@media (max-width: 600px) { .hh-name { font-size: 40px !important; gap: 8px; } }
@media (prefers-reduced-motion: reduce) { .hh-nm, .hh-wave { animation: none !important; clip-path: none; } }
/* Tilt must win over older hover/entrance transforms while the mouse is over the card */
.tilt.tilting { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-2px) !important; }

@media (max-width: 700px) {
  .dc1 { left: -18% !important; top: -6% !important; transform: translateZ(70px) rotateY(14deg); }
  .dc2 { right: -16% !important; top: 30% !important; transform: translateZ(80px) rotateY(-12deg); }
  .dc3 { right: -2% !important; transform: translateZ(50px) rotateY(-8deg); }
  .mb-price { right: 26px !important; width: 54px !important; top: -26px !important; }
}
@media (max-width: 800px) { .case-head { flex-wrap: nowrap; } .case-head > .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; } }

/* =================== Accent words (replace the slanted neon gradient) =================== */
/* Highlighter marker that sweeps behind the word */
.hl { padding: 0 .1em; margin: 0 -.05em; color: inherit; background: linear-gradient(transparent 56%, rgba(79,124,255,.42) 56%, rgba(79,124,255,.42) 90%, transparent 90%) no-repeat 0 0 / 100% 100%; animation: hlSweep .9s .35s cubic-bezier(.3,.7,.2,1) both; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
@keyframes hlSweep { from { background-size: 0% 100%; } }
/* Underline that draws itself */
.ul-draw { position: relative; display: inline-block; }
.ul-draw::after { content: ''; position: absolute; left: 0; right: 0; bottom: -.06em; height: .1em; min-height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--success)); transform-origin: left; animation: ulDraw .8s .35s cubic-bezier(.3,.7,.2,1) both; }
@keyframes ulDraw { from { transform: scaleX(0); } }
/* Typewriter: code font with a blinking cursor block */
.typed { font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 600; letter-spacing: -.04em; font-size: .86em; }
.typed::after { content: ''; display: inline-block; width: .5em; height: .95em; margin-left: .12em; vertical-align: -.1em; background: var(--accent); border-radius: 2px; animation: blink 1.05s steps(1) infinite; }
/* Inline code chip */
.code-chip { font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 600; font-size: .78em; padding: .04em .38em .1em; border-radius: .28em; vertical-align: .06em; background: var(--raised-2); border: 1px solid var(--border); color: var(--tok-builtin); box-shadow: 0 .18em 0 rgba(0,0,0,.25); }
/* Bold word followed by a green tick that pops in */
.tick-word::after { content: '✓'; display: inline-grid; place-items: center; width: 1em; height: 1em; margin-left: .22em; font-size: .7em; vertical-align: .15em; border-radius: 50%; background: var(--success); color: #fff; animation: iconPop .5s .5s cubic-bezier(.3,1.7,.5,1) both; }
/* In landing sections these wait until the section scrolls into view */
.rv:not(.in) .hl, .rv:not(.in) .ul-draw::after, .rv:not(.in) .tick-word::after { animation: none; }
.rv:not(.in) .hl { background-size: 0% 100%; }
.rv:not(.in) .ul-draw::after { transform: scaleX(0); }
.rv:not(.in) .tick-word::after { transform: scale(0); }
@media (prefers-reduced-motion: reduce) { .hl, .ul-draw::after, .typed::after, .tick-word::after { animation: none !important; } .rv:not(.in) .hl { background-size: 100% 100%; } .rv:not(.in) .ul-draw::after, .rv:not(.in) .tick-word::after { transform: none; } }

/* =================== Phones: light and smooth =================== */
/* The story plays by itself in a normal-height section (no long pinned scroll). */
.story.auto { height: auto; }
.story.auto .story-stage { position: relative; height: auto; min-height: 0; padding-top: 40px; padding-bottom: 40px; }
.story.auto .story-devices { height: 480px; }
@media (max-width: 760px), (hover: none) and (pointer: coarse) {
  /* Big glows: keep the colour, drop the costly blur and movement */
  .cine-glow, .hh-bg i { filter: none !important; animation: none !important; opacity: .45; }
  .aurora { filter: none !important; opacity: .55; }
  .aurora i { animation: none !important; }
  /* Frosted glass → plain dark glass (backdrop blur is very heavy on phones) */
  .dc-in, .auth-card, .pp-term, .hh-continue, .ob-scrim, .rank-chip, .ph-scrim, .hh-hero .rank-chip { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .dc-in { background: rgba(19,19,24,.9); }
  .auth-card { background: var(--raised); }
  .pp-term { background: rgba(8,8,10,.94); }
  .hh-hero .hh-continue { background: rgba(12,12,18,.78); }
  .ob-scrim { background: rgba(0,0,0,.9); }
  /* The giant word fades in without the blur */
  .d3-word { animation: wordInLite .9s .1s ease-out forwards; }
  .d3-shadow { filter: none; }
  .sky .sun, .sky-night .moon { box-shadow: none; }
  .stars i { box-shadow: none; }
  .cloud { filter: none; }
  .tilt::after { display: none; }
}
@keyframes wordInLite { from { opacity: 0; } to { opacity: 1; } }

/* =================== Phones: flat, light hero (no 3D layers, no moving parts except one gentle bob) =================== */
@media (max-width: 760px), (hover: none) and (pointer: coarse) {
  .d3-word { background: none !important; -webkit-background-clip: border-box !important; background-clip: border-box !important; color: rgba(237,237,240,.22) !important; will-change: auto; transform: none !important; animation: wordInLite .6s ease-out forwards; }
  [data-theme="light"] .d3-word { color: rgba(24,32,51,.16) !important; }
  .d3-scene { perspective: none; }
  .d3-rig { transform: none !important; transform-style: flat; will-change: auto; }
  .d3-logo { transform-style: flat; transform: none; }
  .d3-float { transform-style: flat; animation: d3FloatLite 5s ease-in-out infinite; }
  @keyframes d3FloatLite { 0%, 100% { transform: translateY(-4px); } 50% { transform: translateY(5px); } }
  .d3-layer { display: none; }
  .d3-face { box-shadow: 0 7px 0 #1a2f8f, 0 16px 26px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.4); }
  .d3-sheen { display: none; }
  .d3-card { transform: none !important; }
  .dc-in { animation: none !important; }
  .cine-grid { -webkit-mask-image: none; mask-image: none; opacity: .25; }
  .mini-block .d3-layer { display: none; }
  .mini-block { animation: none; opacity: 1; transform: none; }
  .mini-block .mb-float { transform-style: flat; animation: none; }
  .mq-row.rev { display: none; }
}

/* ===== Free plan (Levels 0–2) ===== */
.free-banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 16px; text-decoration: none; color: inherit; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent); }
.free-banner > span:first-child { font-size: 26px; }
.free-banner b { display: block; }
.free-banner small { color: var(--muted, #9aa3b2); }
.free-banner .grow { flex: 1; min-width: 0; }
@media (max-width: 640px) { .free-banner { flex-wrap: wrap; } .free-banner .btn { width: 100%; justify-content: center; } }
.free-try { display: block; margin-top: 12px; font-weight: 700; text-align: center; }

/* ===== Netlify badge on phones: keep the bottom menu above it ===== */
@media (max-width: 640px) {
  body.has-nl-badge .rail { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  body.has-nl-badge .main-col { padding-bottom: calc(128px + env(safe-area-inset-bottom)); }
  body.has-nl-badge .sidebar { bottom: calc(124px + env(safe-area-inset-bottom)); }
  body.has-nl-badge .toast { bottom: calc(142px + env(safe-area-inset-bottom)); }
}
/* ===== Free levels finished ===== */
.free-done .fd-next { text-align: left; margin: 14px auto 4px; max-width: 360px; padding: 12px 16px; border-radius: 14px; background: var(--raised); border: 1px solid var(--border); }
.free-done .fd-next b { display: block; margin-bottom: 6px; }
.free-done .fd-next ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; color: var(--muted, #9aa3b2); }
.free-done .fd-next li { display: flex; align-items: center; gap: 6px; }
@media (max-width: 640px) {
  body.has-nl-badge .modal-scrim { padding-bottom: 72px; }
  body.has-nl-badge .modal { max-height: calc(100vh - 104px); }
}

/* ===================== Lesson videos (js/lessonvideo.js) ===================== */
body.lv-open { overflow: hidden; }
.lv-root { position: fixed; inset: 0; z-index: 3000; display: flex; flex-direction: column; color: #F5F3FF; font-family: Inter, system-ui, sans-serif; background: #0B0820; }
.lv-bg { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 12% 8%, rgba(255,94,126,.28), transparent 40%), radial-gradient(circle at 92% 30%, rgba(79,124,255,.30), transparent 45%), radial-gradient(circle at 50% 110%, rgba(34,197,94,.20), transparent 50%), linear-gradient(160deg, #120A2E, #1E1B4B 55%, #0B0820); }
.lv-top { position: relative; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); }
.lv-ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lv-ttl b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-ttl b code, .lv-root code { font-family: "JetBrains Mono", ui-monospace, monospace; background: rgba(255,255,255,.12); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.lv-sc { font-size: 12px; opacity: .7; }
.lv-ic { flex: none; min-width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.08); color: #fff; font-size: 17px; cursor: pointer; display: grid; place-items: center; padding: 0 10px; }
.lv-ic:hover { background: rgba(255,255,255,.16); }
.lv-ic.big { min-width: 54px; height: 48px; font-size: 20px; background: linear-gradient(135deg, #4F7CFF, #8B5CF6); border: 0; }
.lv-ic.txt { font-size: 14px; font-weight: 800; }
.lv-stage { position: relative; z-index: 1; flex: 1; min-height: 0; overflow: hidden; }
.lv-holder { height: 100%; overflow-y: auto; overflow-x: hidden; padding: 12px 16px 24px; display: flex; flex-direction: column; }
.lv-scene { margin: auto; width: 100%; max-width: 820px; opacity: 0; transform: translateY(14px); transition: opacity .35s, transform .45s cubic-bezier(.2,1,.3,1); }
.lv-scene.show { opacity: 1; transform: none; }
.lv-root .in { opacity: 1 !important; transform: none !important; }
.lv-root.paused .lv-stage::after { content: "⏸ Paused — tap to continue"; position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); padding: 8px 16px; border-radius: 20px; background: rgba(0,0,0,.6); font-size: 13px; font-weight: 700; }
/* intro */
.lv-intro { position: relative; text-align: center; padding: 30px 8px; }
.lv-orb { width: 120px; height: 120px; margin: 0 auto 18px; border-radius: 34px; background: linear-gradient(135deg, #4F7CFF, #A855F7 60%, #F472B6); box-shadow: 0 20px 60px rgba(139,92,246,.55); position: relative; animation: lvfloat 3s ease-in-out infinite; }
.lv-orb::after { content: "▶"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 46px; color: #fff; }
@keyframes lvfloat { 50% { transform: translateY(-10px) rotate(3deg); } }
.lv-intro .lv-eyebrow, .lv-intro h1, .lv-intro .lv-goal, .lv-intro .lv-meta { opacity: 0; transform: translateY(12px); transition: all .5s; }
.lv-eyebrow { font-size: 13px; font-weight: 800; letter-spacing: .14em; color: #A5B4FC; }
.lv-intro h1 { font-size: clamp(30px, 6vw, 46px); line-height: 1.1; margin: 10px 0 14px; letter-spacing: -.02em; }
.lv-goal { font-size: clamp(17px, 3.6vw, 21px); color: #FDE68A; margin: 0 auto 12px; max-width: 560px; }
.lv-meta { font-size: 13px; opacity: .75; }
/* section */
.lv-section { text-align: center; padding: 30px 8px; }
.lv-badge { display: inline-block; padding: 10px 22px; border-radius: 30px; font-weight: 900; letter-spacing: .12em; font-size: 15px; background: linear-gradient(90deg, #4F7CFF, #8B5CF6); opacity: 0; transform: scale(.6); transition: all .45s cubic-bezier(.2,1.6,.4,1); }
.lv-section.idea .lv-badge { background: linear-gradient(90deg, #F59E0B, #F97316); }
.lv-section.warn .lv-badge { background: linear-gradient(90deg, #EF4444, #F43F5E); }
.lv-section.recap .lv-badge { background: linear-gradient(90deg, #10B981, #14B8A6); }
.lv-section.plain .lv-badge { background: rgba(255,255,255,.14); }
.lv-section h2 { font-size: clamp(28px, 6vw, 44px); line-height: 1.15; margin: 18px 0 0; letter-spacing: -.02em; opacity: 0; transform: translateY(14px); transition: all .5s; }
/* text */
.lv-text { padding: 10px 4px; }
.lv-sent { font-size: clamp(20px, 4.4vw, 28px); line-height: 1.45; font-weight: 600; margin: 0 0 14px; opacity: 0; transform: translateY(10px); transition: all .45s; color: rgba(245,243,255,.55); }
.lv-sent.now { color: #fff; }
.lv-sent strong { color: #FDE68A; }
.lv-sent code { color: #93C5FD; }
/* editor + console */
.lv-boxhead { display: inline-block; margin: 0 0 12px; padding: 8px 16px; border-radius: 14px; font-weight: 800; font-size: clamp(15px, 3.4vw, 18px); background: rgba(255,255,255,.1); }
.lv-boxhead.warn { background: rgba(239,68,68,.22); color: #FECACA; }
.lv-boxhead.predict { background: rgba(168,85,247,.25); color: #E9D5FF; }
.lv-boxhead.trace { background: rgba(34,211,238,.18); color: #A5F3FC; }
.lv-boxhead.quiz { background: rgba(250,204,21,.18); color: #FEF08A; }
.lv-boxhead.recap { background: rgba(16,185,129,.2); color: #A7F3D0; }
.lv-editor { border-radius: 18px; overflow: hidden; background: #0D1117; border: 1px solid #2A3142; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.lv-editor.bad { border-color: rgba(239,68,68,.6); }
.lv-edbar { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: #161B26; font-size: 13px; color: #9FB0CF; font-weight: 600; }
.lv-edbar .dots { display: flex; gap: 6px; } .lv-edbar .dots i { width: 10px; height: 10px; border-radius: 50%; background: #FF5F57; } .lv-edbar .dots i:nth-child(2) { background: #FEBC2E; } .lv-edbar .dots i:nth-child(3) { background: #28C840; }
.lv-run { margin-left: auto; padding: 5px 14px; border-radius: 10px; background: #22C55E; color: #fff; font-weight: 800; transition: transform .15s, box-shadow .2s; }
.lv-run.press { transform: scale(.88); box-shadow: 0 0 0 6px rgba(34,197,94,.35); }
.lv-pre { margin: 0; padding: 12px 0; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: clamp(14px, 3.3vw, 17px); line-height: 1.6; overflow-x: auto; color: #E6EDF3; }
.lv-cl { display: flex; padding: 0 14px 0 0; border-left: 4px solid transparent; transition: background .2s; }
.lv-cl.cur { background: rgba(250,204,21,.16); border-left-color: #FACC15; }
.lv-ln { flex: none; width: 34px; text-align: right; padding-right: 12px; color: #4B556B; user-select: none; }
.lv-code { white-space: pre; }
.lv-caret { display: inline-block; width: 2px; height: 1.1em; background: #fff; vertical-align: text-bottom; margin-left: 1px; animation: lvblink .9s steps(1) infinite; }
@keyframes lvblink { 50% { opacity: 0; } }
mark.lv-glow { background: rgba(250,204,21,.28); color: inherit; border-radius: 4px; box-shadow: 0 0 0 2px rgba(250,204,21,.65), 0 0 18px rgba(250,204,21,.55); animation: lvglow 1.2s ease-in-out 2; }
@keyframes lvglow { 50% { box-shadow: 0 0 0 4px rgba(250,204,21,.9), 0 0 26px rgba(250,204,21,.8); } }
.lv-console { margin-top: 12px; border-radius: 16px; background: #05070D; border: 1px solid #22304A; padding: 10px 14px; opacity: 0; transform: translateY(10px); transition: all .4s; }
.lv-console.err { background: #2A0C14; border-color: #FF4D5E; }
.lv-console.shake { animation: lvshake .5s; }
@keyframes lvshake { 20% { transform: translateX(-10px); } 40% { transform: translateX(9px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
.lv-clabel { font-size: 11px; font-weight: 900; letter-spacing: .14em; opacity: .7; margin-bottom: 4px; }
.lv-outpre { margin: 0; min-height: 1.4em; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: clamp(14px, 3.3vw, 17px); line-height: 1.55; color: #7CF0A9; white-space: pre-wrap; word-break: break-word; }
.lv-console.err .lv-outpre { color: #FFB3BC; }
.lv-after { margin-top: 14px; padding: 14px 16px; border-radius: 16px; background: rgba(255,255,255,.07); font-size: clamp(16px, 3.6vw, 19px); line-height: 1.5; opacity: 0; transform: translateY(10px); transition: all .45s; }
.lv-after.fix { background: rgba(34,197,94,.14); border: 1px solid rgba(34,197,94,.45); }
.lv-after p { margin: 0 0 8px; } .lv-after p:last-child { margin: 0; }
.lv-after strong { color: #86EFAC; }
/* predict countdown */
.lv-count { display: none; align-items: center; gap: 14px; margin-top: 14px; padding: 14px 16px; border-radius: 18px; background: linear-gradient(135deg, rgba(168,85,247,.3), rgba(79,124,255,.25)); }
.lv-count.in { display: flex; animation: lvin .35s; }
@keyframes lvin { from { opacity: 0; transform: scale(.9); } }
.lv-count .ring { --p: 0; flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(#FACC15 calc(var(--p) * 360deg), rgba(255,255,255,.15) 0); }
.lv-count .ring span { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: #1E1B4B; font-size: 24px; font-weight: 900; }
.lv-count b { font-size: 20px; } .lv-count small { display: block; opacity: .8; font-size: 14px; }
.lv-console.ans { border-color: rgba(34,197,94,.6); }
/* trace */
.lv-trace { display: grid; grid-template-columns: 1.2fr 1fr; gap: 12px; }
.lv-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.lv-side .lv-console { margin-top: 0; }
.lv-vars { border-radius: 16px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); padding: 10px 12px; }
.lv-varlist { display: grid; gap: 6px; }
.lv-var { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 12px; background: #161B26; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 14px; }
.lv-var.new { animation: lvpop .6s; box-shadow: 0 0 0 2px #22D3EE; }
@keyframes lvpop { 0% { transform: scale(.9); background: rgba(34,211,238,.35); } 100% { transform: none; } }
.lv-var .k { color: #93C5FD; font-weight: 700; } .lv-var .t { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: rgba(255,255,255,.1); color: #C4B5FD; } .lv-var .v { color: #FDE68A; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-frame { font-size: 12px; font-weight: 800; color: #A5F3FC; margin-top: 4px; }
.lv-empty { font-size: 13px; opacity: .6; }
.lv-stepn { margin-left: auto; color: #FACC15; font-weight: 800; }
@media (max-width: 700px) { .lv-trace { grid-template-columns: 1fr; } }
/* list / table / cards */
.lv-list, .lv-check { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.lv-list li, .lv-check li { padding: 14px 16px 14px 50px; position: relative; border-radius: 16px; background: rgba(255,255,255,.08); font-size: clamp(17px, 3.8vw, 21px); line-height: 1.45; opacity: 0; transform: translateX(-16px); transition: all .45s; }
.lv-list li::before { content: "➜"; position: absolute; left: 18px; top: 14px; color: #A78BFA; font-weight: 900; }
ol.lv-list { counter-reset: lvn; } ol.lv-list li::before { counter-increment: lvn; content: counter(lvn); width: 24px; height: 24px; border-radius: 50%; background: #8B5CF6; color: #fff; display: grid; place-items: center; font-size: 13px; left: 14px; top: 15px; }
.lv-check li::before { content: "✓"; position: absolute; left: 16px; top: 13px; width: 24px; height: 24px; border-radius: 50%; background: #22C55E; display: grid; place-items: center; font-weight: 900; font-size: 14px; }
.lv-tablewrap { overflow-x: auto; border-radius: 16px; }
.lv-table { width: 100%; border-collapse: collapse; font-size: clamp(14px, 3.3vw, 17px); background: rgba(255,255,255,.05); }
.lv-table th { text-align: left; padding: 12px 14px; background: linear-gradient(90deg, #4F7CFF, #8B5CF6); font-weight: 800; }
.lv-table td { padding: 11px 14px; border-top: 1px solid rgba(255,255,255,.1); }
.lv-table tbody tr { opacity: 0; transform: translateY(8px); transition: all .4s; }
.lv-card { text-align: center; padding: 26px 20px; border-radius: 26px; background: linear-gradient(145deg, rgba(245,158,11,.22), rgba(249,115,22,.12)); border: 1px solid rgba(253,230,138,.35); opacity: 0; transform: scale(.94); transition: all .5s cubic-bezier(.2,1.4,.4,1); }
.lv-card.tip { background: linear-gradient(145deg, rgba(34,211,238,.2), rgba(79,124,255,.12)); border-color: rgba(165,243,252,.35); }
.lv-card.try { background: linear-gradient(145deg, rgba(34,197,94,.2), rgba(20,184,166,.12)); border-color: rgba(134,239,172,.4); }
.lv-bigemo { font-size: 64px; line-height: 1; animation: lvfloat 3s ease-in-out infinite; }
.lv-cardlabel { margin-top: 8px; font-size: 12px; font-weight: 900; letter-spacing: .16em; opacity: .75; }
.lv-card h3 { font-size: clamp(22px, 5vw, 30px); margin: 8px 0 10px; }
.lv-cardbody { font-size: clamp(17px, 3.8vw, 20px); line-height: 1.5; opacity: 0; transform: translateY(8px); transition: all .45s; text-align: left; }
.lv-cardbody p { margin: 0 0 10px; }
.lv-mini { margin: 10px 0; padding: 12px 14px; border-radius: 14px; background: #0D1117; border: 1px solid #2A3142; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: clamp(13px, 3.2vw, 16px); line-height: 1.55; overflow-x: auto; white-space: pre; color: #E6EDF3; text-align: left; }
.lv-mini.out { color: #7CF0A9; background: #05070D; } .lv-mini.err { color: #FFB3BC; background: #2A0C14; border-color: #FF4D5E; }
.lv-hint { font-size: 15px; opacity: .85; text-align: center; }
/* quiz */
.lv-qq { font-size: clamp(20px, 4.4vw, 26px); font-weight: 700; margin-bottom: 10px; line-height: 1.35; }
.lv-opts { display: grid; gap: 10px; margin-top: 12px; }
.lv-opt { text-align: left; padding: 14px 16px; border-radius: 16px; border: 2px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: #fff; font-size: clamp(16px, 3.6vw, 19px); cursor: pointer; opacity: 0; transform: translateY(8px); transition: all .3s; font-family: inherit; }
.lv-opt b { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 8px; border-radius: 8px; background: rgba(255,255,255,.14); }
.lv-opt:hover:not(:disabled) { border-color: #A78BFA; }
.lv-opt.right { border-color: #22C55E; background: rgba(34,197,94,.18); } .lv-opt.wrong { border-color: #EF4444; background: rgba(239,68,68,.18); }
.lv-why { margin-top: 12px; font-size: clamp(16px, 3.6vw, 18px); line-height: 1.5; opacity: 0; transform: translateY(6px); transition: all .35s; }
.lv-qact { margin-top: 12px; text-align: right; }
.lv-skip, .lv-btn { padding: 10px 18px; border-radius: 14px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; font-weight: 800; font-size: 15px; cursor: pointer; font-family: inherit; }
/* outro */
.lv-outro { text-align: center; padding: 26px 8px; }
.lv-outro h2 { font-size: clamp(30px, 6vw, 42px); margin: 10px 0; }
.lv-outro p { font-size: 18px; opacity: .9; }
.lv-outbtns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.lv-btn.primary { background: linear-gradient(135deg, #22C55E, #14B8A6); border: 0; }
/* chapters + controls */
.lv-chapters { position: absolute; z-index: 5; right: 12px; top: calc(60px + env(safe-area-inset-top)); width: min(300px, calc(100% - 24px)); max-height: 60vh; overflow-y: auto; padding: 10px; border-radius: 18px; background: #161B26; border: 1px solid #2A3142; box-shadow: 0 20px 60px rgba(0,0,0,.5); display: grid; gap: 4px; }
.lv-chapters[hidden] { display: none; }
.lv-chhead { font-size: 12px; font-weight: 900; letter-spacing: .14em; opacity: .7; padding: 4px 8px; }
.lv-chapters button { text-align: left; padding: 10px 12px; border-radius: 12px; border: 0; background: transparent; color: #fff; font-size: 15px; cursor: pointer; font-family: inherit; }
.lv-chapters button:hover { background: rgba(255,255,255,.08); }
.lv-bottom { position: relative; z-index: 2; padding: 8px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(5,3,15,.65); }
body.has-nl-badge .lv-bottom { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.lv-bar { display: flex; flex-wrap: nowrap; gap: 2px; height: 14px; align-items: center; cursor: pointer; }
.lv-bar .seg { min-width: 2px; flex-basis: 0 !important; height: 6px; border-radius: 3px; background: rgba(255,255,255,.16); overflow: hidden; transition: height .15s; }
.lv-bar .seg:hover { height: 10px; }
.lv-bar .seg i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4F7CFF, #F472B6); pointer-events: none; }
.lv-bar .seg.done i { width: 100%; }
.lv-bar .seg.k-section { background: rgba(255,255,255,.32); }
.lv-ctrls { display: flex; align-items: center; gap: 8px; margin-top: 8px; justify-content: center; }
.lv-time { min-width: 44px; text-align: center; font-size: 13px; opacity: .7; font-variant-numeric: tabular-nums; }
/* the call-to-action card on the lesson page */
.lv-cta { display: flex; align-items: center; gap: 14px; width: 100%; margin: 6px 0 22px; padding: 16px 18px; border-radius: 20px; border: 0; cursor: pointer; text-align: left; color: #fff; font-family: inherit;
  background: linear-gradient(135deg, #4F7CFF 0%, #8B5CF6 55%, #EC4899 100%); box-shadow: 0 14px 40px rgba(139,92,246,.35); transition: transform .15s, box-shadow .2s; }
.lv-cta:hover { transform: translateY(-2px); box-shadow: 0 18px 50px rgba(139,92,246,.5); }
.lv-cta .pl { flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.22); font-size: 22px; animation: lvpulse 1.8s ease-in-out infinite; }
@keyframes lvpulse { 50% { box-shadow: 0 0 0 10px rgba(255,255,255,.12); } }
.lv-cta b { display: block; font-size: 18px; }
.lv-cta small { display: block; font-size: 13px; opacity: .9; margin-top: 2px; }
.lv-cta .ch { margin-left: auto; flex: none; font-size: 12px; font-weight: 800; padding: 6px 10px; border-radius: 10px; background: rgba(0,0,0,.2); }
@media (max-width: 480px) { .lv-cta .ch { display: none; } .lv-holder { padding: 10px 12px 18px; } }
@media (prefers-reduced-motion: reduce) { .lv-orb, .lv-bigemo, .lv-cta .pl { animation: none; } }

/* callout text column must be allowed to shrink, or long code inside pushes the page sideways on phones */
.callout > div { min-width: 0; flex: 1 1 auto; }
@media (max-width:640px){ .lesson table { display:block; overflow-x:auto; -webkit-overflow-scrolling:touch; font-size:14.5px; } }
.lesson-next .btn { max-width: 100%; white-space: normal; text-align: left; height: auto; min-height: 44px; }
@media (max-width:640px){ .main .btn { max-width: 100%; white-space: normal; height: auto; min-height: 40px; padding-top: 8px; padding-bottom: 8px; line-height: 1.25; } .main .btn-lg { min-height: 50px; } }
.lv-ic.lv-music { position: relative; }
.lv-ic.lv-music.off { opacity: .75; filter: grayscale(1); }
.lv-ic.lv-music.off::after { content: ""; position: absolute; left: 22%; right: 22%; top: 50%; height: 2px; border-radius: 2px; background: #fff; transform: rotate(-40deg); }
