/* ==========================================================================
   XForLab Obsidian Design System — Elite Developer Gamification & IDE Theme
   ========================================================================== */

:root {
  --bg-void: #060913;
  --bg-deep: #090d1a;
  --bg-card: rgba(14, 21, 38, 0.78);
  --bg-card-solid: #0e1526;
  --bg-elevated: #152039;
  --bg-input: #0a1020;
  --border: rgba(148, 163, 184, 0.13);
  --border-strong: rgba(148, 163, 184, 0.25);
  --border-glow: rgba(0, 229, 255, 0.45);

  --text-bright: #f8fafc;
  --text-main: #e2e8f0;
  --text-soft: #94a3b8;
  --text-muted: #64748b;

  --cyan: #00e5ff;
  --cyan-soft: rgba(0, 229, 255, 0.14);
  --violet: #8b5cf6;
  --violet-soft: rgba(139, 92, 246, 0.16);
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.15);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.16);
  --rose: #f43f5e;
  --rose-soft: rgba(244, 63, 94, 0.15);

  --font-sans: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
  --nav-h: 56px;
}

/* ---- Editor Color Themes (Workbench) ---- */
:root, [data-editor-theme="obsidian"] {
  --wb-bg: #050d1f; --wb-editor: #04132b; --wb-side: #070e20; --wb-panel: #040914; --wb-border: rgba(100, 145, 210, 0.18);
  --wb-fg: #e2e8f0; --wb-muted: #8b9bb4; --wb-accent: #00e5ff;
  --tk-kw: #38bdf8; --tk-fn: #34d399; --tk-str: #fde047; --tk-num: #c084fc; --tk-com: #64748b; --tk-bi: #67e8f9;
}
[data-editor-theme="vscode-dark"] {
  --wb-bg: #181818; --wb-editor: #1e1e1e; --wb-side: #141414; --wb-panel: #111111; --wb-border: #2d2d2d;
  --wb-fg: #d4d4d4; --wb-muted: #858585; --wb-accent: #0078d4;
  --tk-kw: #569cd6; --tk-fn: #dcdcaa; --tk-str: #ce9178; --tk-num: #b5cea8; --tk-com: #6a9955; --tk-bi: #4ec9b0;
}
[data-editor-theme="tokyo-night"] {
  --wb-bg: #16161e; --wb-editor: #1a1b26; --wb-side: #13131a; --wb-panel: #101016; --wb-border: #292e42;
  --wb-fg: #c0caf5; --wb-muted: #565f89; --wb-accent: #7aa2f7;
  --tk-kw: #bb9af7; --tk-fn: #7aa2f7; --tk-str: #9ece6a; --tk-num: #ff9e64; --tk-com: #565f89; --tk-bi: #2ac3de;
}
[data-editor-theme="solarized-dark"] {
  --wb-bg: #00212b; --wb-editor: #002b36; --wb-side: #001b24; --wb-panel: #00161e; --wb-border: #09404f;
  --wb-fg: #93a1a1; --wb-muted: #657b83; --wb-accent: #2aa198;
  --tk-kw: #859900; --tk-fn: #268bd2; --tk-str: #2aa198; --tk-num: #d33682; --tk-com: #586e75; --tk-bi: #b58900;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background-color: var(--bg-void);
  background-image:
    radial-gradient(ellipse 75% 45% at 15% -8%, rgba(0, 229, 255, 0.11), transparent 60%),
    radial-gradient(ellipse 65% 40% at 85% -5%, rgba(139, 92, 246, 0.12), transparent 60%),
    radial-gradient(circle at 50% 100%, rgba(16, 185, 129, 0.06), transparent 55%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ROCK-SOLID VIEWPORT LOCK IN CODING ARENA — ZERO HORIZONTAL OR VERTICAL WOBBLE */
html.arena-locked,
html.arena-locked body,
body.arena-locked {
  overflow: hidden !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  overscroll-behavior: none !important;
}
html.arena-locked #xf-view {
  width: 100vw;
  height: calc(100dvh - var(--nav-h));
  overflow: hidden !important;
}

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.22); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 229, 255, 0.45); }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--cyan) !important;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- TOP NAVBAR ---- */
.xf-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(6, 9, 19, 0.84);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.xf-nav-left { display: flex; align-items: center; gap: 22px; min-width: 0; }

.xf-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 16.5px;
  letter-spacing: -0.025em;
  color: var(--text-bright);
  flex-shrink: 0;
}
.xf-logo-mark svg { width: 27px; height: 27px; display: block; filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.3)); }
.xf-brand-dot { color: var(--cyan); font-weight: 600; font-size: 13px; opacity: 0.85; margin-left: 1px; }

.xf-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.xf-nav-links::-webkit-scrollbar { display: none; }
.xf-nav-item {
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
  transition: all 0.16s ease;
}
.xf-nav-item:hover { color: var(--text-bright); background: rgba(255, 255, 255, 0.05); }
.xf-nav-item.active {
  color: #67e8f9;
  background: rgba(0, 229, 255, 0.11);
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.28);
}

.xf-nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.xf-pill-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}
.xf-pill-btn:hover { border-color: var(--cyan); color: var(--text-bright); }
.xf-pill-btn.active { border-color: var(--cyan); color: #67e8f9; background: var(--cyan-soft); }

.xf-streak-pill {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.xf-player-pill {
  height: 34px;
  padding: 0 12px;
  border-radius: 99px;
  border: 1px solid rgba(0, 229, 255, 0.32);
  background: linear-gradient(135deg, rgba(14, 21, 38, 0.95), rgba(21, 32, 57, 0.9));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.18s;
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.08);
}
.xf-player-pill:hover { border-color: var(--cyan); box-shadow: 0 0 22px rgba(0, 229, 255, 0.22); transform: translateY(-1px); }
.xf-lvl-tag { font-family: var(--font-mono); font-size: 11.5px; font-weight: 800; color: var(--cyan); }
.xf-rank-tag { font-size: 12px; font-weight: 600; color: var(--text-bright); }
.xf-xp-bar-mini { width: 54px; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.xf-xp-bar-mini > span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--cyan), var(--emerald)); transition: width 0.45s ease; }
.xf-xp-tag { font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; color: #a7f3d0; }

@media (max-width: 1080px) { .xf-hide-md { display: none; } }
@media (max-width: 820px) { .xf-hide-sm { display: none; } .xf-navbar { padding: 0 12px; } }
/* Phones: brand + status pills on row 1, scrollable section links on row 2.
   --nav-h grows with it, so .wb-shell and sticky offsets stay below the navbar. */
@media (max-width: 600px) {
  :root { --nav-h: 88px; }
  .xf-navbar { flex-wrap: wrap; align-content: center; row-gap: 4px; column-gap: 8px; padding: 6px 12px; }
  .xf-nav-left { display: contents; }
  .xf-nav-right { margin-left: auto; gap: 6px; }
  .xf-nav-links { order: 3; flex: 1 0 100%; }
  .xf-brand-dot, .xf-xp-bar-mini { display: none; }
}

/* ---- PAGE CONTAINER & CARDS ---- */
.xf-page {
  max-width: 1260px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.xf-glass {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 12px 32px rgba(0, 0, 0, 0.32);
}

.xf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(21, 32, 57, 0.75);
  color: var(--text-bright);
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.xf-btn:hover:not(:disabled) { border-color: var(--cyan); background: rgba(0, 229, 255, 0.12); }
.xf-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.xf-btn-primary {
  background: linear-gradient(135deg, #00c6ff, #10b981);
  border: none;
  color: #03151d;
  font-weight: 800;
  box-shadow: 0 4px 20px rgba(0, 229, 255, 0.25);
}
.xf-btn-primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); background: linear-gradient(135deg, #00c6ff, #10b981); color: #03151d; }

.xf-btn-sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 7px; }

/* Copy button on read-only code blocks (js/copycode.js) */
.xf-code-wrap { position: relative; }
.xf-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  opacity: 0;
}
.xf-code-wrap:hover .xf-copy-btn,
.xf-copy-btn:focus-visible { opacity: 1; }
@media (hover: none) {
  .xf-copy-btn { opacity: 1; }
}
.xf-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.xf-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

/* ---- COMMAND CENTER HERO ---- */
.xf-hero-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}
@media (max-width: 920px) { .xf-hero-grid { grid-template-columns: 1fr; } }

.xf-hero-card {
  padding: 26px 28px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(14, 21, 38, 0.92), rgba(18, 28, 52, 0.82));
  border: 1px solid rgba(0, 229, 255, 0.24);
}
.xf-hero-card::before {
  content: "";
  position: absolute;
  top: -70px;
  right: -70px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.18), transparent 70%);
  pointer-events: none;
}

.xf-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 8px;
}

.xf-hero-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.18;
  color: var(--text-bright);
  margin-bottom: 10px;
}

.xf-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 20px;
}
@media (max-width: 600px) { .xf-stats-row { grid-template-columns: repeat(2, 1fr); } }

.xf-stat-box {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(6, 9, 19, 0.65);
  border: 1px solid var(--border);
}
.xf-stat-val { font-family: var(--font-mono); font-size: 20px; font-weight: 800; color: var(--text-bright); line-height: 1.2; }
.xf-stat-lbl { font-size: 11.5px; color: var(--text-soft); margin-top: 2px; }

/* ---- ACTIVITY HEATMAP ---- */
.xf-heatmap-card { padding: 22px 24px; display: flex; flex-direction: column; justify-content: space-between; }
.xf-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 4px;
  margin-top: 12px;
}
.xf-hm-col { display: flex; flex-direction: column; gap: 4px; }
.xf-hm-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.03);
}
.xf-hm-cell[data-lv="1"] { background: rgba(16, 185, 129, 0.32); }
.xf-hm-cell[data-lv="2"] { background: rgba(16, 185, 129, 0.58); }
.xf-hm-cell[data-lv="3"] { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.45); }
.xf-hm-cell[data-lv="4"] { background: #00e5ff; box-shadow: 0 0 10px rgba(0, 229, 255, 0.55); }

/* ---- TRACK CARDS GRID ---- */
.xf-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 14px;
}
.xf-section-title { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; color: var(--text-bright); }

.xf-tracks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.xf-track-card {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  position: relative;
  overflow: hidden;
}
.xf-track-card:hover {
  transform: translateY(-3px);
  border-color: var(--track-accent, var(--cyan));
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), 0 0 24px rgba(0, 229, 255, 0.09);
}

.xf-prog-track { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.xf-prog-fill { height: 100%; border-radius: 99px; transition: width 0.45s ease; }

/* ---- VISUAL WORLD MAP (CONSTELLATION SKILL TREE) ---- */
.xf-worlds-stack { display: flex; flex-direction: column; gap: 22px; }

.xf-world-zone {
  padding: 22px 26px;
  position: relative;
  overflow: hidden;
}
.xf-world-nodes {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.xf-qnode {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(8, 12, 24, 0.85);
  color: var(--text-main);
  transition: all 0.18s ease;
  cursor: pointer;
  min-width: 195px;
  text-align: left;
}
.xf-qnode:hover:not(.locked) {
  transform: translateY(-2px);
  border-color: var(--cyan);
  box-shadow: 0 8px 22px rgba(0, 229, 255, 0.16);
}
.xf-qnode.done { border-color: rgba(16, 185, 129, 0.55); background: rgba(16, 185, 129, 0.09); }
.xf-qnode.current {
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.14), 0 0 22px rgba(0, 229, 255, 0.22);
}
.xf-qnode.boss { border-color: rgba(245, 158, 11, 0.5); }
.xf-qnode.boss.done { border-color: var(--emerald); background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(245, 158, 11, 0.1)); }
.xf-qnode.locked { opacity: 0.4; cursor: not-allowed; }
.xf-node-connector { width: 22px; height: 2px; background: var(--border-strong); flex-shrink: 0; }
.xf-node-connector.lit { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }

/* ---- 2-PANE SPLIT WORKBENCH (ZERO JITTER) ---- */
.wb-shell {
  width: 100%;
  max-width: 100vw;
  height: calc(100dvh - var(--nav-h));
  display: grid;
  grid-template-rows: 40px minmax(0, 1fr) 44px;
  background: var(--wb-bg);
  color: var(--wb-fg);
  overflow: hidden;
  position: relative;
}

.wb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--wb-side);
  border-bottom: 1px solid var(--wb-border);
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}
@media (max-width: 600px) {
  .wb-topbar { padding: 0 10px; }
  /* Progress is also in the bottom bar ("Exercise n / m") and XP in the lesson header. */
  .wb-top-world, .wb-prog-bar, #wb-world-pct, #wb-xp-pill { display: none; }
}
.wb-prog-bar {
  width: 150px;
  height: 9px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  flex-shrink: 0;
}
.wb-prog-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #84cc16, #22c55e);
  border-radius: 99px;
  transition: width 0.35s ease;
}

.wb-body {
  display: grid;
  grid-template-columns: var(--wb-lesson-w, 46%) minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  position: relative;
}
@media (max-width: 900px) {
  .wb-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: 45% 55%; }
  .wb-split-x { display: none; }
}

/* Drag handles between panes (thin line; accent only on hover/focus/drag) */
.wb-split { position: relative; z-index: 6; flex-shrink: 0; background: transparent; touch-action: none; }
.wb-split::before { content: ""; position: absolute; inset: 0; }
.wb-split::after { content: ""; position: absolute; background: var(--wb-accent); opacity: 0; transition: opacity 0.12s; pointer-events: none; }
.wb-split:hover::after, .wb-split:focus-visible::after, .wb-split.dragging::after { opacity: 1; }
.wb-split:focus-visible { outline-offset: -2px; }
.wb-split-x { position: absolute; top: 0; bottom: 0; left: var(--wb-lesson-w, 46%); width: 8px; margin-left: -4px; cursor: col-resize; }
.wb-split-x::after { top: 0; bottom: 0; left: 3px; width: 2px; }
.wb-split-y { height: 8px; margin: -4px 0; cursor: row-resize; }
.wb-split-y::after { left: 0; right: 0; top: 3px; height: 2px; }
@media (pointer: coarse) {
  .wb-split-x::before { inset: 0 -8px; }
  .wb-split-y::before { inset: -8px 0; }
}
body.wb-resizing, body.wb-resizing * { user-select: none !important; }
body.wb-resizing-x, body.wb-resizing-x * { cursor: col-resize !important; }
body.wb-resizing-y, body.wb-resizing-y * { cursor: row-resize !important; }

/* Slide-Over Curriculum Drawer (Opened from bottom-left ☰ button) */
.wb-drawer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(320px, 86vw);
  z-index: 40;
  background: #070d1d;
  border-right: 1px solid rgba(0, 229, 255, 0.35);
  box-shadow: 18px 0 48px rgba(0, 0, 0, 0.78);
  overflow-y: auto;
  overflow-x: hidden;
  transform: translateX(-104%);
  transition: transform 0.2s ease;
}
.wb-drawer.open { transform: translateX(0); }
.wb-tree-world { padding: 10px 14px 4px; font-size: 11px; font-weight: 800; color: var(--cyan); text-transform: uppercase; letter-spacing: 0.06em; }
.wb-tree-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 14px 7px 18px;
  border: none;
  background: transparent;
  color: var(--wb-fg);
  font-size: 13px;
  text-align: left;
}
.wb-tree-item:hover:not(.locked) { background: rgba(255, 255, 255, 0.06); }
.wb-tree-item.active { background: rgba(0, 229, 255, 0.14); color: #67e8f9; font-weight: 700; border-left: 3px solid var(--wb-accent); }
.wb-tree-item.locked { opacity: 0.38; cursor: not-allowed; }

.wb-lesson-pane {
  border-right: 1px solid var(--wb-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--wb-bg);
}
.wb-tabstrip {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: var(--wb-side);
  border-bottom: 1px solid var(--wb-border);
  flex-shrink: 0;
  min-width: 0;
}
.wb-file-tab {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--wb-fg);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.wb-lesson-scroll {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 28px 34px;
  word-break: break-word;
}
.wb-lesson-title {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 700;
  color: #f8fafc;
  margin: 4px 0 14px;
  line-height: 1.3;
}
.wb-lesson-scroll h3 {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  color: #60a5fa;
  margin: 20px 0 9px;
}
.wb-lesson-scroll p, .wb-lesson-scroll li { font-size: 14.5px; line-height: 1.68; color: var(--wb-fg); margin-bottom: 9px; }
.wb-lesson-scroll ul, .wb-lesson-scroll ol { padding-left: 20px; margin-bottom: 10px; }
.wb-lesson-scroll code { font-family: var(--font-mono); font-size: 12.5px; background: rgba(255,255,255,0.08); color: #93c5fd; padding: 2px 6px; border-radius: 4px; }
.wb-code-sample {
  font-family: var(--font-mono);
  font-size: 12.8px;
  line-height: 1.55;
  background: var(--wb-panel);
  border: 1px solid var(--wb-border);
  border-radius: 8px;
  padding: 11px 14px;
  margin: 8px 0 12px;
  overflow-x: auto;
  max-width: 100%;
  white-space: pre;
}

.wb-code-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--wb-editor);
}
.wb-editor-wrap { flex: 1; min-height: 0; min-width: 0; position: relative; overflow: hidden; }
.wb-shell .CodeMirror {
  height: 100% !important;
  width: 100% !important;
  font-family: var(--font-mono) !important;
  font-size: 14px !important;
  line-height: 1.64 !important;
  background: var(--wb-editor) !important;
  color: var(--wb-fg) !important;
  padding-top: 8px;
}
.wb-shell .CodeMirror-gutters { background: var(--wb-editor) !important; border-right: 1px solid rgba(255,255,255,0.06) !important; }
.wb-shell .CodeMirror-linenumber { color: var(--wb-muted) !important; padding: 0 10px 0 8px !important; }
.wb-shell .CodeMirror-cursor { border-left: 2px solid var(--wb-accent) !important; }
.wb-shell .CodeMirror-activeline-background { background: rgba(255,255,255,0.04) !important; }
.wb-shell .CodeMirror-selected { background: rgba(0, 229, 255, 0.22) !important; }
.wb-shell .cm-keyword { color: var(--tk-kw) !important; font-weight: 600; }
.wb-shell .cm-def { color: var(--tk-fn) !important; font-weight: 600; }
.wb-shell .cm-builtin { color: var(--tk-bi) !important; }
.wb-shell .cm-string, .wb-shell .cm-string-2 { color: var(--tk-str) !important; }
.wb-shell .cm-number { color: var(--tk-num) !important; }
.wb-shell .cm-comment { color: var(--tk-com) !important; font-style: italic; }

/* Action toolbar between editor and terminal */
.wb-actionbar {
  height: 44px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--wb-editor);
  border-top: 1px solid var(--wb-border);
  flex-shrink: 0;
}
.wb-tool-btn {
  height: 32px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.75);
  color: var(--wb-fg);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.wb-tool-btn:hover { border-color: var(--cyan); background: rgba(0, 229, 255, 0.12); }
.wb-submit-btn {
  height: 34px;
  padding: 0 16px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 3px 0 #0369a1;
}
.wb-submit-btn:hover:not(:disabled) { filter: brightness(1.08); }
.wb-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* Run / Submit while Python is loading (aria-disabled keeps tooltip + focus) */
.wb-btn-wait[aria-disabled="true"] { opacity: 0.55; cursor: progress; filter: none; }

.wb-stdin-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--wb-side);
  border-top: 1px solid var(--wb-border);
  flex-shrink: 0;
}
.wb-stdin-bar.open { display: flex; }
.wb-stdin-bar textarea {
  flex: 1;
  height: 40px;
  background: var(--wb-panel);
  border: 1px solid var(--wb-border);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  resize: none;
}

.wb-dock {
  height: 36%;
  min-height: 145px;
  max-height: 235px;
  background: var(--wb-panel);
  border-top: 1px solid var(--wb-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
}
.wb-shell.wb-dock-sized .wb-dock { height: var(--wb-dock-h); min-height: 0; max-height: none; }
.wb-dock-tabs {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--wb-side);
  border-bottom: 1px solid var(--wb-border);
  flex-shrink: 0;
}
.wb-dtab {
  height: 32px;
  padding: 0 11px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--wb-muted);
  font-size: 12px;
  font-weight: 700;
}
.wb-dtab.active { color: var(--wb-accent); border-bottom-color: var(--wb-accent); }
.wb-dock-body { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: auto; padding: 10px 14px; font-family: var(--font-mono); font-size: 12.6px; white-space: pre-wrap; }

.wb-diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.wb-diff-box { background: rgba(255,255,255,0.03); border: 1px solid var(--wb-border); border-radius: 6px; padding: 7px 10px; overflow-x: auto; }

/* Bottom bar: [☰] Quest Title · Exercise X/Y [DONE!] ... [Back] [Next] */
.wb-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: #060a15;
  border-top: 1px solid var(--wb-border);
  font-size: 12.5px;
  color: var(--wb-fg);
  min-width: 0;
}
.wb-next-gold {
  height: 30px;
  padding: 0 16px;
  border-radius: 7px;
  border: none;
  background: linear-gradient(180deg, #facc15, #eab308);
  color: #1c1917;
  font-weight: 800;
  font-size: 12.5px;
  box-shadow: 0 2px 0 #a16207;
}
.wb-next-gold:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }

/* ---- ILLUSTRATED CARDS & HEADINGS ---- */
.xf-heading {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-bright);
}

.xf-jump-banner {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.35);
  min-height: 245px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 28px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.xf-jump-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.xf-jump-content { position: relative; z-index: 1; max-width: 440px; }

.xf-art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 18px;
}
.xf-art-card {
  border-radius: 14px;
  overflow: hidden;
  background: #0a1020;
  border: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.xf-art-card:hover {
  transform: translateY(-4px);
  border-color: var(--cyan);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.55);
}
.xf-art-thumb {
  height: 146px;
  width: 100%;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.xf-art-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  gap: 12px;
}
.xf-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #cbd5e1;
}

/* ---- COURSE UNIT VIEW & INTERACTIVE LABS ---- */
.xf-unit-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .xf-unit-layout { grid-template-columns: 1fr; } }

.xf-unit-sidebar { position: sticky; top: calc(var(--nav-h) + 20px); padding: 14px; }
.xf-unit-nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}
.xf-unit-nav-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-bright); }
.xf-unit-nav-btn.active { background: var(--cyan-soft); color: #67e8f9; font-weight: 700; }

.xf-prose h2 { font-size: 20px; font-weight: 800; color: var(--text-bright); margin: 22px 0 10px; }
.xf-prose p { margin-bottom: 12px; color: var(--text-main); }
.xf-prose ul, .xf-prose ol { padding-left: 22px; margin-bottom: 12px; }
.xf-prose li { margin-bottom: 5px; }
.xf-prose code { font-family: var(--font-mono); font-size: 12.8px; background: rgba(0, 229, 255, 0.09); border: 1px solid rgba(0, 229, 255, 0.2); color: #67e8f9; padding: 1px 6px; border-radius: 5px; }
.xf-prose pre {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.58;
  background: #070b15;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 16px;
  overflow-x: auto;
  margin: 10px 0 14px;
}

.xf-table-wrap { overflow-x: auto; margin: 12px 0 16px; border-radius: 10px; border: 1px solid var(--border); }
.xf-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.xf-table th { background: rgba(21, 32, 57, 0.85); color: #67e8f9; text-align: left; padding: 9px 13px; font-weight: 700; border-bottom: 1px solid var(--border); }
.xf-table td { padding: 8px 13px; border-bottom: 1px solid var(--border); color: var(--text-main); }
.xf-table tr:last-child td { border-bottom: none; }

.xf-lab-box {
  margin: 22px 0;
  padding: 20px 22px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(11, 18, 35, 0.95), rgba(16, 26, 48, 0.9));
  border: 1px solid rgba(0, 229, 255, 0.32);
  box-shadow: 0 0 28px rgba(0, 229, 255, 0.07);
}
.xf-lab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.xf-input, .xf-select {
  height: 36px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text-bright);
  font-size: 13.5px;
  outline: none;
}
.xf-input:focus, .xf-select:focus { border-color: var(--cyan); }

/* ---- QUIZ OPTIONS ---- */
.xf-qcard { padding: 18px 20px; margin-bottom: 14px; }
.xf-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 13px;
  margin-top: 7px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(8, 12, 24, 0.65);
  cursor: pointer;
  transition: all 0.14s;
}
.xf-opt:hover { border-color: rgba(0, 229, 255, 0.4); background: rgba(0, 229, 255, 0.06); }
.xf-opt.selected { border-color: var(--cyan); background: rgba(0, 229, 255, 0.13); }
.xf-opt.correct { border-color: var(--emerald); background: rgba(16, 185, 129, 0.15); }
.xf-opt.wrong { border-color: var(--rose); background: rgba(244, 63, 94, 0.14); }

/* ---- MODALS, TOASTS & CONFETTI ---- */
.xf-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 18, 0.78);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 200;
  padding: 16px;
}
.xf-modal-backdrop[hidden] { display: none; }
.xf-modal {
  width: min(560px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  background: #0c1324;
  border: 1px solid var(--border-glow);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
}
.xf-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.xf-icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text-soft); }
.xf-icon-btn:hover { border-color: var(--cyan); color: #fff; }

.xf-toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.xf-toast {
  background: #0d162c;
  border: 1px solid var(--cyan);
  color: var(--text-bright);
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
  animation: xfSlideUp 0.24s ease-out;
}
@keyframes xfSlideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

#xf-confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 240; }

/* ---- SQL SCHEMA & RESULT GRID IN WORKBENCH ---- */
.wb-sql-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: normal;
}
.wb-sql-table th {
  background: rgba(0, 229, 255, 0.1);
  color: #67e8f9;
  text-align: left;
  padding: 6px 10px;
  border: 1px solid var(--wb-border);
  font-weight: 700;
}
.wb-sql-table td {
  padding: 5px 10px;
  border: 1px solid var(--wb-border);
  color: var(--wb-fg);
}
.wb-story-banner {
  padding: 11px 14px;
  margin: 8px 0 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(0, 229, 255, 0.09));
  border: 1px solid rgba(139, 92, 246, 0.35);
  font-size: 13.4px;
  color: var(--text-bright);
}
