/* Interactive Theory & Practice Book — Modern Sidebar Editorial Layout */
:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --ink: #0f172a;
  --sub: #475569;
  --faint: #64748b;
  --blue: #047857;
  --blue-d: #065f46;
  --accent: #0062c4;
  --accent-text: #0058b0;
  --accent-soft: #eef5ff;
  --card: #f1f5f9;
  --card2: #f8fafc;
  --line: #cbd5e1;
  --line2: #e2e8f0;
  --green: #047857;
  --green-bg: #ecfdf5;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --btn-dark-bg: #0f172a;
  --btn-dark-ink: #ffffff;
  --sidebar-w: 300px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow-hover: 0 8px 20px rgba(15, 23, 42, 0.06);
  --r: 14px;
}

/* Unit accent palette (all >= 5.0:1 with #ffffff) */
[data-unit="9"]  { --accent: #0062c4; --accent-text: #0058b0; --accent-soft: #eff6ff; }
[data-unit="10"] { --accent: #6d28d9; --accent-text: #5b21b6; --accent-soft: #f5f3ff; }
[data-unit="11"] { --accent: #b45309; --accent-text: #92400e; --accent-soft: #fffbeb; }
[data-unit="12"] { --accent: #15803d; --accent-text: #166534; --accent-soft: #f0fdf4; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: calc(16px * var(--read-scale, 1));
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

button, [role="button"], select, summary { min-height: 2.2rem; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

h1 { font-size: clamp(26px, 4vw, 42px); line-height: 1.12; letter-spacing: -0.022em; font-weight: 800; margin: 0 0 12px; color: var(--ink); }
h2 { font-size: clamp(21px, 2.8vw, 29px); letter-spacing: -0.015em; font-weight: 700; margin: 0 0 10px; line-height: 1.24; }
h3 { font-size: 18.5px; font-weight: 700; letter-spacing: -0.01em; margin: 22px 0 8px; }
h4 { font-size: 16px; font-weight: 700; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.sub { color: var(--sub); }
.small { font-size: 13.5px; }
.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.87em;
  background: var(--card);
  border: 1px solid var(--line2);
  padding: 1px 6px;
  border-radius: 6px;
  color: #be123c;
  word-break: break-word;
}

/* ---------- App Shell: Sidebar + Main Workspace ---------- */
.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 12px;
  left: 12px;
  bottom: 12px;
  width: var(--sidebar-w);
  background: #fbfcfd;
  border: 1px solid var(--line2);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  z-index: 120;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), width 0.2s ease;
}

.shell.sb-collapsed .sidebar {
  transform: translateX(calc(-100% - 20px));
}

.sb-head {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
}

.sb-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sb-brand {
  border: 0;
  background: transparent;
  padding: 2px 0;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.sb-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
}
.brand-svg {
  display: block;
  border-radius: 9px;
}
.sb-brand-pill {
  display: inline-block;
  margin-left: 3px;
  padding: 0 5px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-text);
  vertical-align: 1px;
}

.sb-brand-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sb-brand-txt b {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.sb-brand-txt span {
  font-size: 12px;
  color: var(--faint);
  font-weight: 500;
}

.sb-close-btn {
  border: 0;
  background: transparent;
  color: var(--faint);
  border-radius: 7px;
  width: 28px;
  height: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  flex: none;
}
.sb-close-btn:hover { background: var(--card); color: var(--ink); }

.sb-search-wrap {
  position: relative;
}
.sb-search-ico {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
  display: inline-flex;
}
.sb-search {
  width: 100%;
  padding: 7px 28px 7px 31px;
  border-radius: 8px;
  border: 1px solid var(--line2);
  background: var(--card2);
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.sb-search:focus {
  background: var(--surface);
  border-color: var(--accent);
  outline: none;
}
.sb-search::-webkit-search-cancel-button { display: none; }
.sb-search-clear[hidden] { display: none; }
.sb-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--faint);
  width: 22px;
  height: 22px;
  min-height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sb-search-clear:hover { background: var(--card); color: var(--ink); }

.sb-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.sb-nav::-webkit-scrollbar { width: 5px; }
.sb-nav::-webkit-scrollbar-track { background: transparent; }
.sb-nav::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
.sb-nav::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.sb-sec-lbl {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 12px 10px 4px;
  margin-top: 6px;
  border-top: 1px solid var(--line2);
}
.sb-sec-lbl:first-child { padding-top: 2px; margin-top: 0; border-top: 0; }

.sb-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--sub);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-decoration: none;
  text-align: left;
  min-height: 2rem;
  transition: background 0.12s ease, color 0.12s ease;
}
.sb-item-l {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sb-item-txt {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-ico {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--faint);
}
.sb-item:hover {
  background: var(--card);
  color: var(--ink);
}
.sb-item.on {
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
}
.sb-item.on .sb-ico { color: var(--accent-text); }
.sb-cnt-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  background: var(--card2);
  border: 1px solid var(--line2);
  border-radius: 999px;
  padding: 1px 7px;
  flex: none;
}
.sb-item.on .sb-cnt-pill {
  border-color: var(--line);
  color: var(--ink);
}

.sb-unit-group {
  margin-top: 3px;
  border-radius: 9px;
  padding: 2px;
  transition: background 0.14s ease;
}
.sb-unit-group.open {
  background: rgba(15, 23, 42, 0.02);
}

.sb-unit-btn {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  text-align: left;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.sb-unit-btn:hover { background: var(--card); }
.sb-unit-btn.active {
  background: var(--surface);
  border-color: var(--line2);
}

.sb-unit-badge {
  flex: none;
  min-width: 30px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sb-unit-btn.active .sb-unit-badge {
  background: var(--accent);
  color: #ffffff;
}

.sb-unit-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.sb-unit-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.28;
}
.sb-unit-sub {
  font-size: 12px;
  color: var(--faint);
  margin-top: 1px;
}
.sb-chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--faint);
  transition: transform 0.16s ease;
  flex: none;
}
.sb-unit-group.open .sb-chev { transform: rotate(90deg); }

.sb-lessons {
  display: none;
  padding: 4px 2px 6px 8px;
  margin: 2px 0 2px 18px;
  border-left: 1px solid var(--line2);
  flex-direction: column;
  gap: 2px;
}
.sb-unit-group.open .sb-lessons { display: flex; }

.sb-lesson-btn {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--sub);
  display: flex;
  align-items: center;
  gap: 7px;
  line-height: 1.32;
  min-height: 1.95rem;
}
.sb-lesson-btn:hover { background: var(--card); color: var(--ink); }
.sb-lesson-btn.on {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}
.sb-lesson-num {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--faint);
  min-width: 18px;
}
.sb-lesson-btn.on .sb-lesson-num { color: var(--accent-text); }
.sb-lesson-title {
  flex: 1;
  min-width: 0;
}
.sb-l-cnt {
  font-size: 12px;
  color: var(--faint);
  font-weight: 600;
  flex: none;
}

.sb-topics {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 3px 0 6px 8px;
  margin-left: 8px;
  border-left: 1px solid var(--line2);
}
.sb-topic-btn {
  width: 100%;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  padding: 4px 8px;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: 12px;
  color: var(--sub);
  line-height: 1.35;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-height: 1.75rem;
  transition: background 0.12s ease, color 0.12s ease;
}
.sb-topic-btn:hover { background: var(--card); color: var(--ink); }
.sb-topic-btn.on {
  background: var(--accent-soft);
  border-left-color: var(--accent-text);
  color: var(--accent-text);
  font-weight: 600;
}
.sb-t-num {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  min-width: 14px;
  padding-top: 1px;
}
.sb-topic-btn.on .sb-t-num { color: var(--accent-text); }
.sb-t-title {
  flex: 1;
  min-width: 0;
}
.sb-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--faint);
}

.sb-foot {
  padding: 10px 12px;
  border-top: 1px solid var(--line2);
  background: var(--surface);
}
.sb-compiler-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  background: var(--card2);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.sb-compiler-link:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.sb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(2px);
  z-index: 110;
}

/* ---------- Main Area & Floating Contextual Navbar ---------- */
.main-col {
  flex: 1;
  min-width: 0;
  margin-left: calc(var(--sidebar-w) + 12px);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.shell.sb-collapsed .main-col {
  margin-left: 0;
}

.ctxbar {
  position: sticky;
  top: 0;
  z-index: 60;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 24px 8px;
  background: linear-gradient(to bottom, var(--bg) 62%, transparent);
  pointer-events: none;
}

.ctxbar-in {
  width: 100%;
  padding: 8px 14px;
  border-radius: 14px;
  border: 1px solid var(--line2);
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: auto;
}

.ctx-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.menu-btn {
  border: 1px solid var(--line2);
  background: #ffffff;
  color: var(--ink);
  border-radius: 10px;
  padding: 5px 11px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.menu-btn:hover { background: var(--card); }

.crumb {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crumb-nav {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}
.crumb-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 7px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.14s ease, color 0.14s ease;
}
.crumb-link:hover {
  background: var(--card);
  color: var(--accent-text);
}
.crumb-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.crumb-sep {
  color: var(--faint);
  font-size: 14px;
  padding: 0 1px;
  user-select: none;
  flex-shrink: 0;
}
.crumb-cur {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.index-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin: 18px 0 24px;
}
.index-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  min-height: 44px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line2);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.index-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.index-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.index-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.index-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 2px 9px;
  border-radius: 6px;
}
.index-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
}
.index-title {
  margin: 2px 0 0;
  font-size: 16px;
  line-height: 1.3;
  color: var(--ink);
}

.ctx-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.ctx-chip {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--surface);
  border: 1px solid var(--line2);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.ctx-sandbox {
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line2);
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.ctx-sandbox:hover { background: var(--btn-dark-bg); color: var(--btn-dark-ink); border-color: var(--btn-dark-bg); }

.progressline { height: 2.5px; background: var(--line2); }
.progressline i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.35s ease; }

/* ---------- Page Container ---------- */
.wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px 72px;
}

.hero-card {
  margin-top: 20px;
  background-color: var(--surface);
  background-image: radial-gradient(var(--line2) 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1px solid var(--line2);
  border-radius: 20px;
  padding: 28px 28px;
  box-shadow: var(--shadow);
}
.hero-card h1 {
  font-size: clamp(23px, 2.9vw, 33px);
  line-height: 1.18;
  text-wrap: balance;
}
.hero-brand-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.hero-brand-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.hero-brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.hero-brand-name span {
  color: #10b981;
}
.hero-brand-bar .eyebrow {
  align-self: flex-start;
  margin: 0;
  background: transparent;
  border: 0;
  padding: 0;
  border-radius: 0;
  white-space: normal;
  line-height: 1.35;
}
.brand-spectrum {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  height: 3px;
  max-width: 180px;
  margin-top: 18px;
}
.brand-spectrum span { border-radius: 999px; display: block; height: 100%; }
.brand-spectrum .bs-u9  { background: #0071e3; }
.brand-spectrum .bs-u10 { background: #6d28d9; }
.brand-spectrum .bs-u11 { background: #d97706; }
.brand-spectrum .bs-u12 { background: #15803d; }

.hero { padding: 26px 0 8px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.lede { font-size: clamp(16px, 2vw, 18.5px); color: var(--sub); max-width: 760px; line-height: 1.52; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

section.block {
  padding: 26px 0 6px;
  border-top: 1px solid var(--line2);
  margin-top: 24px;
}
section.block:first-of-type { border-top: 0; margin-top: 16px; }

.kicker {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-text);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ---------- Overview Metrics & Cards ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0 0;
}
.stat-card {
  background: #ffffff;
  border: 1px solid var(--line2);
  border-radius: 14px;
  padding: 13px 15px;
}
.stat-num {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.15;
}
.stat-lbl {
  font-size: 12.5px;
  color: var(--sub);
  margin-top: 2px;
}

.grid { display: grid; gap: 14px; margin: 12px 0; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 18px 20px;
  min-width: 0;
}

.card.white {
  background: #ffffff;
  border: 1px solid var(--line2);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card.unit-card {
  display: flex;
  flex-direction: column;
}
.card.unit-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--line);
}
.card.unit-card .unit-actions {
  margin-top: auto;
  padding-top: 12px;
}

.card p:last-child { margin-bottom: 0; }

.unit-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--line2);
  overflow: hidden;
  margin: 10px 0 12px;
}
.unit-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.point-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 14px;
  padding: 14px 16px;
  min-width: 0;
}
.point-num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.note {
  background: var(--card2);
  border: 1px solid var(--line2);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 14px 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
}
.note > b:first-child {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 5px;
  color: var(--sub);
}

.note.analogy {
  background: var(--amber-bg);
  border-color: rgba(180, 83, 9, 0.25);
}
.note.analogy > b:first-child {
  color: #92400e;
}

.code-card {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #334155;
  background: #0f172a;
  margin: 14px 0;
}
.code-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #1e293b;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.code-copy-btn {
  border: 1px solid #475569;
  background: #334155;
  color: #f8fafc;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-height: 1.7rem;
}
.code-copy-btn:hover { background: var(--blue); border-color: var(--blue); }

.syntax-pre {
  background: #0f172a;
  color: #f8fafc;
  padding: 14px 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.55;
  overflow-x: auto;
  margin: 0;
  white-space: pre;
}

ul.tight { margin: 6px 0 10px; padding-left: 20px; }
ul.tight li { margin: 4px 0; }

/* ---------- Buttons & Inline Lesson/Topic Switcher ---------- */
.btn {
  border: 0;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 10px;
  cursor: pointer;
  min-height: 2.4rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.btn:hover { filter: brightness(0.92); }
.btn:active { transform: scale(0.98); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--card); filter: none; }
.btn.dark { background: var(--btn-dark-bg); color: var(--btn-dark-ink); }
.btn:disabled { opacity: 0.45; cursor: default; }

.picker-box {
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 14px 16px;
  margin: 14px 0 12px;
  box-shadow: var(--shadow);
}

.picker-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--faint);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topic-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.topic-pill {
  border: 1px solid var(--line2);
  background: var(--card2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.topic-pill:hover { border-color: var(--accent); color: var(--accent-text); }
.topic-pill.on { background: var(--accent); border-color: var(--accent); color: #ffffff; font-weight: 600; }
.topic-pill.done:not(.on) { border-color: rgba(21, 128, 61, 0.4); color: var(--green); }

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.seg button {
  border: 1px solid var(--line);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.seg button:hover { color: var(--ink); border-color: var(--accent); background: var(--card2); }
.seg button.on { background: var(--btn-dark-bg); border-color: var(--btn-dark-bg); color: var(--btn-dark-ink); }

/* ---------- Interactive Visual Lab & TRY IT ---------- */
.exp {
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 16px 0;
}
.try-brief {
  margin: 6px 0 12px;
}
.try-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.exp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.exp-head .tag {
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  background: var(--accent);
  border-radius: 999px;
  padding: 3px 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.exp-head h4 { margin: 0; font-size: 17px; }

.vis-stage {
  background: var(--card2);
  border: 1px solid var(--line2);
  border-radius: 14px;
  padding: 16px;
  margin: 10px 0 12px;
  overflow: hidden;
}

.slider-row {
  display: grid;
  grid-template-columns: 140px 1fr 80px;
  gap: 12px;
  align-items: center;
  margin: 6px 0;
}
.slider-row label { font-weight: 600; font-size: 14px; }
.slider-row .val { font-weight: 700; font-size: 14px; text-align: right; font-family: ui-monospace, monospace; }
input[type=range] { width: 100%; accent-color: var(--accent-text); cursor: pointer; }

.req-flow { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.req-node { flex: 1; min-width: 110px; background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; text-align: center; font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease; }
.req-node.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); box-shadow: 0 0 0 1px var(--accent); }
.req-arrow { font-weight: 700; color: var(--faint); font-size: 18px; }

.sem-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.sem-box { background: var(--surface); color: var(--ink); border: 1.5px dashed var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s ease; }
.sem-box.full { grid-column: 1 / -1; }
.sem-box.active { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

.pipe-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pipe-chip { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; font-family: ui-monospace, monospace; font-weight: 700; font-size: 14px; }
.pipe-chip.hi { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }

.bs-sim-row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; }
.bs-sim-col { background: var(--accent); color: #ffffff; border-radius: 8px; padding: 12px 6px; text-align: center; font-size: 12.5px; font-weight: 700; }

.vis-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0 4px;
}

.vis-tgl {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1.5px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.vis-tgl:hover { border-color: var(--accent); }
.vis-tgl.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.vis-sw {
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  display: inline-block;
  transition: background 0.18s ease;
}
.vis-sw::after {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.18s ease;
}
.vis-tgl.on .vis-sw { background: var(--accent); }
.vis-tgl.on .vis-sw::after { transform: translateX(13px); }

.vis-status {
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
  margin: 10px 0;
  border: 1px solid var(--line2);
  background: var(--card2);
  color: var(--ink);
}
.vis-status.on { background: var(--green-bg); border-color: #bbf7d0; color: var(--green); }
.vis-status.warn { background: var(--amber-bg); border-color: #fde68a; color: var(--amber); }
.vis-status.bad { background: var(--red-bg); border-color: #fecaca; color: var(--red); }

.vis-code-live {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  overflow-x: auto;
  margin: 10px 0 0;
  white-space: pre;
}

.vis-mini-tab {
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 9px 9px 0 0;
}
.vis-mini-page {
  background: #ffffff;
  border: 1px solid var(--line2);
  border-top: 0;
  border-radius: 0 0 9px 9px;
  padding: 14px;
}

.vis-demo-input {
  display: block;
  width: 100%;
  max-width: 340px;
  margin-top: 8px;
  padding: 9px 12px;
  font: inherit;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}
.vis-split2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 600px) { .vis-split2 { grid-template-columns: 1fr; } }
.vis-opt-lbl { display: block; font-size: 14.5px; margin: 5px 0; cursor: pointer; }

.vis-tbl {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid var(--line);
  font-size: 13.5px;
}
.vis-tbl caption {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
}
.vis-tbl th, .vis-tbl td {
  border: 1px solid var(--line);
  text-align: center;
}
.vis-tbl th { background: var(--card); font-weight: 700; }
.vis-tbl .hl-cell { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }

.vis-media-container {
  max-width: 100%;
  margin: 0 auto;
  border: 2px dashed var(--line);
  background: #ffffff;
  border-radius: 12px;
  padding: 10px;
  overflow-x: auto;
  transition: width 0.15s ease;
}
.vis-media-elem {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #ffffff;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  border: 2px solid var(--accent);
  transition: width 0.12s ease, height 0.12s ease;
}
.vis-media-elem.overflowing {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
}
.vis-media-title { font-weight: 700; font-size: 14px; }
.vis-media-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.vis-badge {
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.16);
  padding: 2px 7px;
  border-radius: 999px;
}

.vis-swatch-stage { display: flex; justify-content: center; }
.vis-swatch {
  width: 100%;
  padding: 22px;
  border-radius: 12px;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  border: 1px solid var(--line2);
}

.vis-pos-stage {
  position: relative;
  min-height: 150px;
}
.vis-pos-box {
  width: 145px;
  padding: 14px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
  text-align: center;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16);
}
.vis-pos-box.a { background: var(--blue); }
.vis-pos-box.b {
  position: relative;
  top: -12px;
  left: 65px;
  z-index: 1;
  background: #0f172a;
}

.vis-mq-frame {
  margin: 0 auto;
  display: grid;
  gap: 8px;
  border: 2px dashed var(--line);
  background: #ffffff;
  border-radius: 12px;
  padding: 10px;
  transition: max-width 0.15s ease;
}
.vis-mq-card {
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 1px solid var(--line2);
  border-radius: 10px;
  padding: 16px 8px;
  text-align: center;
  font-weight: 700;
}

.vis-op-stage { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vis-branch {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line2);
  background: #ffffff;
  margin: 5px 0;
  font-size: 13px;
  color: var(--sub);
}
.vis-branch.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
}
.vis-bubble-outer {
  background: #ffffff;
  border: 2px dashed var(--accent);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

/* ---------- Scorebar & Assessments ---------- */
.scorebar {
  background: #ffffff;
  border: 1px solid var(--line2);
  border-radius: 14px;
  padding: 10px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin: 12px 0;
  box-shadow: var(--shadow);
}
.scorebar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scorebar b { font-size: 16px; }
.scorebar-reset {
  border: 1px solid var(--line2);
  background: var(--card2);
  color: var(--sub);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  min-height: 1.9rem;
}
.scorebar-reset:hover { color: var(--red); border-color: var(--red); }

.q {
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 12px 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}
.q .qn { font-size: 12px; font-weight: 700; color: var(--accent-text); letter-spacing: 0.05em; text-transform: uppercase; }
.q .qt { font-weight: 600; margin: 5px 0 10px; }
.opts { display: grid; gap: 8px; }
.opt {
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 44px;
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.14s ease, background 0.14s ease;
}
.opt:hover { border-color: var(--accent); background: var(--card2); }
.opt.right { border-color: var(--green); background: var(--green-bg); font-weight: 600; }
.opt.wrong { border-color: var(--red); background: var(--red-bg); }

.fb { margin-top: 10px; font-weight: 600; font-size: 14px; display: none; }
.fb.show { display: block; }
.fb.good { color: var(--green); }
.fb.bad { color: var(--red); }

/* ---------- Page Navigation & Glossary ---------- */
.pagenav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 34px;
  flex-wrap: wrap;
}
.pagenav .btn { min-width: 195px; justify-content: center; }

.search {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #ffffff;
  margin: 6px 0 12px;
}
.gloss-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.gitem { border-bottom: 1px solid var(--line2); padding: 13px 2px; }
.gitem-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gitem b { font-size: 16px; }
.gitem-cat { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; background: var(--card); color: var(--sub); padding: 2px 8px; border-radius: 999px; }
.gitem p { margin: 4px 0 0; color: var(--sub); }

footer {
  color: var(--faint);
  font-size: 13px;
  text-align: center;
  padding: 28px 16px 8px;
  border-top: 1px solid var(--line2);
  margin-top: 42px;
}

/* ---------- Interactive Coding Games (Grid Garden & Flexbox Pond) ---------- */
.act-card {
  background: #ffffff;
  border: 1px solid var(--line2);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.act-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.act-lvl-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.act-lvl-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  min-height: 2.2rem;
}
.act-lvl-btn:hover { border-color: #04AA6D; color: #04AA6D; }
.act-lvl-btn.on { background: var(--btn-dark-bg); border-color: var(--btn-dark-bg); color: var(--btn-dark-ink); }
.act-lvl-btn.done:not(.on) { border-color: var(--green); background: var(--green-bg); color: var(--green); }

.act-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 840px) {
  .act-split { grid-template-columns: 1fr; }
}

.gg-editor {
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border: 1px solid var(--line2);
  border-radius: 12px;
  padding: 12px;
}
.gg-code-ro {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--sub);
  white-space: pre-wrap;
}
.gg-input {
  width: 100%;
  margin: 6px 0;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.5;
  resize: vertical;
}
.gg-input:focus { border-color: #04AA6D; outline: none; }

.act-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.gg-board {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 360px;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid #6b4423;
  background: #8b5a2b;
}
.gg-soil, .gg-layer {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(5, 20%);
  grid-template-rows: repeat(5, 20%);
}
.gg-cell {
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.gg-carrot {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  z-index: 2;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}
.gg-water {
  background: rgba(14, 165, 233, 0.72);
  border: 2px solid #38bdf8;
  border-radius: 8px;
  margin: 4px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.gg-water.won {
  background: rgba(4, 170, 109, 0.78);
  border-color: #6ee7b7;
}

.fx-board {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid #0284c7;
  background: linear-gradient(135deg, #0ea5e9, #0369a1);
}
.fx-layer {
  position: absolute;
  inset: 14px;
  gap: 10px;
}
.fx-pad {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(22, 163, 74, 0.85);
  border: 2px dashed #bbf7d0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.fx-frog {
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  z-index: 2;
  transition: transform 0.2s ease;
}
.fx-frog.won { transform: scale(1.16); }

/* ---------- Selector Sniper & JS Code Bot Maze ---------- */
.sel-stage {
  background: #f8fafc;
  border: 1px solid var(--line2);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}
.sel-stage .card-row, .sel-stage nav.top, .sel-stage ul.board, .sel-stage form.mini-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  list-style: none;
  padding: 10px;
  margin: 0;
  background: #ffffff;
  border: 1px solid var(--line2);
  border-radius: 10px;
}
.sel-stage .badge, .sel-stage a, .sel-stage li, .sel-stage input {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}
.sel-stage .sub {
  padding: 4px 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.sel-stage .sel-target {
  border-style: dashed !important;
  border-color: #04AA6D !important;
  background: #f0fdf4 !important;
}
.sel-stage .sel-hit {
  background: #dbeafe !important;
  border-color: #0071e3 !important;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

.bot-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 4px;
  aspect-ratio: 1 / 1;
  max-height: 330px;
  width: 100%;
  background: #0f172a;
  padding: 8px;
  border-radius: 14px;
}
.bot-cell {
  background: #1e293b;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  position: relative;
}
.bot-cell.wall { background: #334155; }
.bot-cell.goal { background: #064e3b; border: 1.5px solid #10b981; }
.bot-unit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  background: rgba(14, 165, 233, 0.25);
  border-radius: 8px;
}

/* ---------- VS Code Extensions Section ---------- */
.ext-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ext-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ext-top h4 { margin: 0; }
.ext-badge {
  font-size: 12px;
  font-weight: 700;
  background: #ecfdf5;
  color: #047857;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.ext-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  align-items: center;
}
.btn.small {
  padding: 5px 12px;
  font-size: 12.5px;
  min-height: 1.9rem;
}

/* ---------- Field Training, Exams, Debug & Lesson CTAs ---------- */
.ft-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.ft-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--card);
  color: var(--sub);
  border: 1px solid var(--line2);
  white-space: nowrap;
}
.ft-badge.done {
  background: var(--green-bg);
  color: var(--green);
  border-color: #bbf7d0;
}

.tf-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(90px, 180px));
  gap: 10px;
}

.match-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 2fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--line2);
}
@media (max-width: 720px) {
  .match-row { grid-template-columns: 1fr; gap: 5px; }
}
.match-term { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.match-sel {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  font: inherit;
  font-size: 13.5px;
}
.match-mark { font-weight: 700; font-size: 13.5px; }

.lesson-game-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--green-bg), rgba(37, 99, 235, 0.06));
  border: 1.5px solid #86efac;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 14px 0;
  box-shadow: 0 4px 14px rgba(4, 170, 109, 0.08);
}
.lesson-game-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 240px;
}
.lesson-game-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #047857;
  background: rgba(4, 170, 109, 0.14);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 2px;
}
.lesson-game-title {
  font-size: 15.5px;
  color: var(--ink);
}
html[data-theme="dark"] .lesson-game-cta {
  background: linear-gradient(135deg, rgba(4, 170, 109, 0.14), rgba(37, 99, 235, 0.12));
  border-color: rgba(52, 211, 153, 0.35);
}
html[data-theme="dark"] .lesson-game-badge {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.2);
}

/* ---------- Arabic Toggle, Step Pills, Details & Video Slot ---------- */
.ctx-pref-btn {
  border: 1px solid var(--line2);
  background: var(--surface);
  color: var(--sub);
  border-radius: 999px;
  padding: 4px 11px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 1.95rem;
}
.ctx-pref-btn:hover { border-color: var(--accent); color: var(--ink); background: var(--card); }
.ctx-pref-btn.on { background: var(--card); border-color: var(--line); color: var(--ink); }

.topic-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.extra-badge {
  font-size: 12px;
  font-weight: 700;
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid #fde68a;
  padding: 2px 9px;
  border-radius: 999px;
}

.step-pill {
  display: inline-block;
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid var(--line2);
  padding: 3px 11px;
  border-radius: 999px;
}

.detail-block {
  margin: 14px 0;
}
.detail-block h4 { margin: 0 0 4px; font-size: 15.5px; color: var(--ink); }
.detail-block p { margin: 0; color: var(--sub); }

.note.mistake {
  background: var(--red-bg);
  border-color: rgba(220, 38, 38, 0.25);
  color: var(--ink);
}
.note.mistake > b:first-child {
  color: #b91c1c;
}

.ar-wrap { margin: 10px 0 4px; }
.ar-tgl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line2);
  background: transparent;
  color: var(--sub);
  border-radius: 7px;
  padding: 4px 11px;
  font-family: "Cairo", system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  min-height: 1.85rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ar-tgl:hover,
.ar-tgl.on {
  background: var(--card2);
  border-color: var(--line);
  color: var(--ink);
}
.ar-tgl:focus-visible {
  outline: 2px solid var(--line);
  outline-offset: 2px;
}

.ar-box {
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 8px;
  padding: 12px 16px;
  font-family: "Cairo", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink);
}
.ar-box code {
  background: var(--card2);
  border-color: var(--line2);
  color: var(--ink);
  font-size: 0.84em;
  padding: 1px 5px;
  border-radius: 4px;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}
.ar-text { margin: 0; }
.ar-list { margin: 0; padding-right: 18px; }
.ar-list li { margin: 4px 0; }

.q-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.diff-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--card);
  color: var(--sub);
}
.diff-easy { background: var(--green-bg); color: var(--green); }
.diff-medium { background: var(--amber-bg); color: var(--amber); }
.diff-challenge { background: var(--red-bg); color: var(--red); }

.q-foot {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.w3-ext-row { margin-top: 16px; }

.jump-index {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 12px 0;
}
.jump-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-text);
  text-decoration: none;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
}
.jump-link:hover { text-decoration: underline; }

.video-slot {
  margin: 22px 0 8px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.video-16x9 {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line2);
  background: #0f172a;
}
.video-16x9 iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- Dark Mode Tokens ---------- */
html[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --ink: #f1f5f9;
  --sub: #cbd5e1;
  --faint: #94a3b8;
  --card: #1e293b;
  --card2: #0f172a;
  --line: #334155;
  --line2: #1e293b;
  --accent-text: #60a5fa;
  --accent-soft: #172554;
  --green: #4ade80;
  --green-bg: #064e3b;
  --red: #f87171;
  --red-bg: #450a0a;
  --amber: #fbbf24;
  --amber-bg: #451a03;
  --btn-dark-bg: #f1f5f9;
  --btn-dark-ink: #0f172a;
}
html[data-theme="dark"] [data-unit="9"]  { --accent-text: #60a5fa; --accent-soft: #172554; }
html[data-theme="dark"] [data-unit="10"] { --accent-text: #c084fc; --accent-soft: #2e1065; }
html[data-theme="dark"] [data-unit="11"] { --accent-text: #fbbf24; --accent-soft: #451a03; }
html[data-theme="dark"] [data-unit="12"] { --accent-text: #4ade80; --accent-soft: #064e3b; }
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .sb-head,
html[data-theme="dark"] .sb-foot,
html[data-theme="dark"] .card,
html[data-theme="dark"] .card.white,
html[data-theme="dark"] .exp,
html[data-theme="dark"] .act-card,
html[data-theme="dark"] .q,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .picker-box,
html[data-theme="dark"] .note:not(.analogy):not(.mistake),
html[data-theme="dark"] .topic-pill {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark"] .hero-card {
  background-color: var(--surface);
  background-image: radial-gradient(rgba(148, 163, 184, 0.12) 1px, transparent 1px);
  background-size: 20px 20px;
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark"] code {
  background: #1e293b;
  border-color: #334155;
  color: #fda4af;
}
html[data-theme="dark"] .ctxbar { background: var(--bg); }
html[data-theme="dark"] .ctxbar-in {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .sidebar {
  border-color: var(--line);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .sb-search,
html[data-theme="dark"] .gg-editor,
html[data-theme="dark"] .sel-stage,
html[data-theme="dark"] .vis-stage {
  background: var(--card2);
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark"] .gg-input,
html[data-theme="dark"] .search,
html[data-theme="dark"] .match-sel,
html[data-theme="dark"] .menu-btn,
html[data-theme="dark"] .btn.ghost {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark"] .sb-unit-btn.active { background: var(--card); border-color: var(--line); }
html[data-theme="dark"] .sb-unit-group.open { background: rgba(255, 255, 255, 0.025); }
html[data-theme="dark"] .sb-compiler-link { background: var(--card2); border-color: var(--line); color: var(--ink); }

@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;
  }
}

/* ---------- Responsive Breakpoints ---------- */
@media (max-width: 1023px) {
  .sidebar {
    top: 10px;
    left: 10px;
    bottom: 10px;
    max-width: calc(100vw - 20px);
    transform: translateX(calc(-100% - 20px));
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
  }
  .shell.sb-open-mobile .sidebar {
    transform: translateX(0);
  }
  .shell.sb-open-mobile .sb-backdrop {
    display: block;
  }
  .main-col {
    margin-left: 0 !important;
  }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .g3, .g4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .wrap { padding: 0 14px 84px; }
  .ctxbar { top: 0; padding: 0; background: var(--surface); border-bottom: 1px solid var(--line2); }
  .ctxbar-in { padding: 8px 12px; border-radius: 0; border: 0; box-shadow: none; }
  body.kb-open .ctxbar { position: static; }
  body.kb-open .back-top-btn { display: none !important; }
  .hero-card { padding: 20px 18px; border-radius: 18px; margin-top: 14px; }
  .g2, .g3, .g4, .stats-row { grid-template-columns: 1fr; }
  .sem-layout { grid-template-columns: 1fr; }
  .exp { padding: 14px; border-radius: 14px; }
  .pagenav .btn { width: 100%; min-width: 0; }
  .ctx-sandbox { display: none; }
  .cmdk-overlay { padding: 12px 12px 16px; }
  .cmdk-modal { max-height: calc(100dvh - 28px); }
  .cmdk-list { max-height: none; }
  .cmdk-foot { display: none; }
  .act-lvl-pills {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }
  .act-lvl-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .seg, .seg.seg-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }
  .seg button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .menu-btn,
  .ctx-pref-btn,
  .btn,
  .btn.small,
  .topic-pill,
  .landing-qchip,
  .sb-close,
  .sb-nav-row,
  .sb-unit-btn,
  .sb-lesson-btn,
  .sb-topic-btn,
  .ar-tgl,
  .code-copy-btn,
  .book-theory-tgl {
    min-height: 44px;
  }
  .landing-cta-row,
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 8px;
  }
  .landing-cta-row > *,
  .hero-actions > * {
    width: 100%;
    justify-content: center;
  }
  .landing-pill {
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 480px) {
  .menu-btn .ctx-btn-lbl,
  .ctx-cmdk-btn .ctx-btn-lbl {
    display: none;
  }
  .menu-btn,
  .ctx-cmdk-btn {
    min-width: 44px;
    padding: 0;
    justify-content: center;
  }
}

@media (max-width: 540px) {
  .slider-row { grid-template-columns: 1fr; gap: 4px; }
  .slider-row .val { text-align: left; }
  .req-flow { flex-direction: column; align-items: stretch; gap: 8px; }
  .req-arrow { display: none; }
  .req-node { width: 100%; min-width: 0; text-align: left; min-height: 44px; display: flex; align-items: center; }
}

/* ---------- Quick Reference Table & Watch Out Callout ---------- */
.watch-callout {
  background: var(--accent-soft);
  border-color: rgba(0, 113, 227, 0.24);
  color: var(--ink);
}
.watch-callout > b:first-child {
  color: #0369a1;
}
html[data-theme="dark"] .note.analogy > b:first-child { color: #fbbf24; }
html[data-theme="dark"] .note.mistake > b:first-child { color: #f87171; }
html[data-theme="dark"] .watch-callout > b:first-child { color: #38bdf8; }
html[data-theme="dark"] .ar-box { background: var(--card2); border-color: var(--line); }
html[data-theme="dark"] .ar-box code { background: var(--surface); border-color: var(--line); color: var(--ink); }
.quick-ref-wrap {
  margin: 14px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--card2);
}
.quick-ref-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 440px;
}
.quick-ref-tbl th, .quick-ref-tbl td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.quick-ref-tbl th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ---------- Declaration Deck Game ---------- */
.deck-compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.deck-box-host {
  display: grid;
  place-items: center;
  min-height: 170px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: var(--card);
}
.deck-target-box, .deck-user-box {
  width: 120px;
  height: 120px;
  transition: all 0.2s ease;
  font-weight: 700;
}
.deck-cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.deck-pill {
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  padding: 7px 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}
.deck-pill:hover { border-color: #0284c7; transform: translateY(-1px); }
.deck-pill.picked {
  background: #0284c7;
  color: #fff;
  border-color: #0284c7;
}

/* ---------- Shape Battle + Slide & Compare ---------- */
.sb-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}
.sb-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 0.78rem;
  font-family: ui-monospace, monospace;
  cursor: pointer;
}
.sb-swatch-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.2);
}
.sb-compare-stage {
  position: relative;
  width: 260px;
  height: 180px;
  margin: 8px auto;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--line);
  background: #f8fafc;
}
.sb-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.sb-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 5;
  pointer-events: none;
}

/* ---------- Specificity Showdown Arena ---------- */
.spec-arena {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}
.spec-rule-btn {
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
}
.spec-rule-btn:hover { border-color: #6d28d9; transform: translateY(-1px); }
.spec-rule-btn.right { border-color: #16a34a; background: rgba(22, 163, 74, 0.12); }
.spec-rule-btn.wrong { border-color: #dc2626; background: rgba(220, 38, 38, 0.1); }

html[data-theme="dark"] .deck-pill,
html[data-theme="dark"] .sb-swatch,
html[data-theme="dark"] .spec-rule-btn,
html[data-theme="dark"] .quick-ref-wrap,
html[data-theme="dark"] .rm-card,
html[data-theme="dark"] .uikit-prev {
  background: var(--card2);
  color: var(--ink);
  border-color: var(--line);
}
@media (max-width: 600px) {
  .deck-compare-row, .spec-arena, .rm-cols, .uikit-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Eyeball, Render Match & UI Component Kit ---------- */
.eye-ruler {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: var(--card);
}
.rm-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin: 12px 0;
}
.rm-cols > div,
.uikit-grid > div {
  min-width: 0;
}
.rm-card {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid var(--line2);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  overflow-x: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.rm-card code {
  white-space: normal;
  word-break: break-word;
}
.rm-prev-btn {
  text-align: center;
  min-height: 54px;
}
.rm-card.active {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
}
.rm-card.matched {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.12);
}
.uikit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.uikit-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.uikit-prev {
  padding: 14px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: var(--card2);
}
.seg.seg-tabs {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--line2);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  max-width: 100%;
}
.seg.seg-tabs button {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 6px 13px;
  font-size: 13px;
  color: var(--sub);
}
.seg.seg-tabs button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.seg.seg-compact { gap: 5px; }
.seg.seg-compact button {
  padding: 5px 11px;
  font-size: 12.5px;
  min-height: 2rem;
}
html[data-theme="dark"] .seg.seg-tabs { background: var(--card2); border-color: var(--line); }
html[data-theme="dark"] .seg.seg-tabs button.on { background: var(--card); color: var(--ink); }

/* ---------- Inline Code Completion Drills ---------- */
.fill-code {
  margin: 10px 0 8px;
  padding: 11px 14px;
  border-radius: 9px;
  border: 1px solid var(--line2);
  background: var(--card2);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.fill-inp {
  display: inline-block;
  min-width: 130px;
  max-width: 100%;
  padding: 2px 8px;
  margin: 2px 4px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.fill-inp:focus { outline: none; border-color: var(--accent); }
.fill-inp.right { border-color: var(--green); background: var(--green-bg); }
.fill-inp.wrong { border-color: var(--red); background: var(--red-bg); }
.fill-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Official Bootstrap 5.3 Docs Cheat Sheet ---------- */
.bs-docs-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}
.bs-doc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.bs-doc-head h2 {
  margin: 2px 0 8px;
  font-size: 19px;
}
.bs-doc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.bs-doc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}
.bs-doc-prev-wrap {
  border: 1px solid var(--line2);
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  margin-bottom: 10px;
}
.bs-doc-iframe {
  width: 100%;
  border: 0;
  display: block;
}

/* ---------- Official Textbook Theory Drawer (Student Guide) ---------- */
.book-theory-card {
  margin: 12px 0 18px;
  border: 1px solid var(--line2);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.book-theory-tgl {
  width: 100%;
  border: 0;
  background: var(--card2);
  color: var(--ink);
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  font: inherit;
  transition: background 0.14s ease;
}
.book-theory-tgl:hover { background: var(--card); }
.bt-tgl-l {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.bt-tgl-l b {
  font-size: 14px;
  font-weight: 700;
}
.bt-pill {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.bt-chev {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sub);
  flex: none;
}
.book-theory-body {
  padding: 16px 20px 18px;
  border-top: 1px solid var(--line2);
}
.book-theory-body[hidden] { display: none; }
.bt-sections {
  max-height: 460px;
  overflow-y: auto;
  padding-right: 8px;
}
.bt-sec {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line2);
}
.bt-sec:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.bt-sec-h {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}
.bt-sec-p {
  margin: 0 0 8px;
  font-size: 14.5px;
  line-height: 1.68;
  color: var(--sub);
}
.bt-sec-ul {
  font-size: 14px;
  line-height: 1.65;
  color: var(--sub);
}
.bt-ar-wrap {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line2);
}
html[data-theme="dark"] .book-theory-card {
  background: var(--surface);
  border-color: var(--line);
}
html[data-theme="dark"] .book-theory-tgl {
  background: var(--card2);
  color: var(--ink);
}

/* ---------- Multi-Instructor Video Walkthrough ---------- */
.vid-head h3 { margin: 2px 0 8px; }
.vid-tabs { margin: 4px 0 10px; }
.vid-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.vid-title {
  font-weight: 600;
  color: var(--sub);
}

/* ---------- Ctrl+K Command Palette, Font Scale & Back-to-Top ---------- */
.ctx-kbd {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--card);
  border: 1px solid var(--line2);
  color: var(--faint);
  margin-left: 4px;
}
.ctx-font-grp {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line2);
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}
.ctx-font-btn {
  border: 0;
  background: transparent;
  color: var(--sub);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  min-height: 1.9rem;
  cursor: pointer;
}
.ctx-font-btn:hover { background: var(--card); color: var(--ink); }
.ctx-font-btn + .ctx-font-btn { border-left: 1px solid var(--line2); }

.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 24px;
}
.cmdk-modal {
  width: 100%;
  max-width: 580px;
  max-height: calc(100dvh - 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cmdk-input {
  flex: 0 0 auto;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line2);
  background: transparent;
  color: var(--ink);
  padding: 14px 16px;
  font: inherit;
  font-size: 16px;
  outline: none;
}
.cmdk-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(360px, calc(100dvh - 150px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cmdk-item {
  flex: 0 0 auto;
  width: 100%;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font: inherit;
}
.cmdk-item:hover, .cmdk-item.on { background: var(--card); }
.cmdk-kind {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
  min-width: 58px;
  text-align: center;
}
.cmdk-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cmdk-meta b { font-size: 13.5px; }
.cmdk-empty {
  padding: 22px;
  text-align: center;
  color: var(--faint);
  font-size: 13.5px;
}
.cmdk-foot {
  padding: 8px 14px;
  border-top: 1px solid var(--line2);
  background: var(--card2);
  color: var(--faint);
  font-size: 12px;
  text-align: right;
}

.back-top-btn {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 95;
  width: 44px;
  height: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease, border-color 0.15s ease;
}
.back-top-btn.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-top-btn:hover { border-color: var(--accent); color: var(--accent-text); }

@media (max-width: 640px) {
  .ctx-kbd, .ctx-font-grp { display: none; }
  .landing-nav-in {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 14px;
  }
  .landing-brand-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
  }
  .landing-nav-r {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .landing-nav-r .ctx-pref-btn,
  .landing-nav-r .btn {
    min-height: 40px;
    justify-content: center;
    padding: 6px 8px;
    font-size: 12.5px;
    white-space: nowrap;
  }
}

/* ---------- Organized Coding Games Hub ---------- */
.games-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.game-hub-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  text-align: left;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line2);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  min-width: 0;
  transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
}
.game-hub-card:hover {
  border-color: var(--accent);
  background: var(--card2);
  transform: translateY(-1px);
}
.gh-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.gh-top b {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.gh-badge {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.gh-desc {
  font-size: 12.2px;
  line-height: 1.45;
  color: var(--sub);
}
html[data-theme="dark"] .game-hub-card {
  background: var(--card2);
  border-color: var(--line);
}
html[data-theme="dark"] .game-hub-card:hover {
  background: var(--card);
  border-color: var(--accent);
}

/* ---------- Architectural SVG Concept Diagrams ---------- */
.vis-svg-box {
  width: 100%;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--line2);
  background: var(--surface);
  padding: 10px;
  margin-bottom: 10px;
}
.vis-svg-box svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}
html[data-theme="dark"] .vis-svg-box {
  background: var(--card2);
  border-color: var(--line);
}
@media (max-width: 540px) {
  .games-hub-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Light Landing Page & Beyond-the-Book Sections ---------- */
.landing-shell {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  padding: 12px 20px;
  background: linear-gradient(to bottom, var(--bg) 68%, transparent);
}
.landing-nav-in {
  max-width: 1080px;
  margin: 0 auto;
  padding: 9px 16px;
  border-radius: 16px;
  border: 1px solid var(--line2);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
html[data-theme="dark"] .landing-nav-in {
  background: var(--surface);
  border-color: var(--line);
}
.landing-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.landing-brand-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.landing-nav-r {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.landing-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 20px 64px;
}
.landing-hero {
  text-align: center;
  padding: 36px 24px 32px;
  border-radius: 22px;
  border: 1px solid var(--line2);
  background-color: var(--surface);
  background-image: radial-gradient(rgba(15, 23, 42, 0.055) 1px, transparent 1px);
  background-size: 20px 20px;
  margin-bottom: 22px;
}
html[data-theme="dark"] .landing-hero {
  background-image: radial-gradient(rgba(148, 163, 184, 0.1) 1px, transparent 1px);
  border-color: var(--line);
}
.landing-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.landing-hero h1 {
  margin: 0 auto 12px;
  max-width: 760px;
  font-size: clamp(1.7rem, 3.4vw, 2.55rem);
  line-height: 1.16;
  letter-spacing: -0.025em;
}
.landing-lede {
  max-width: 680px;
  margin: 0 auto 10px;
  color: var(--sub);
  font-size: 15.5px;
  line-height: 1.65;
}
.landing-ar {
  max-width: 660px;
  margin: 0 auto 22px;
  font-family: "Cairo", system-ui, sans-serif;
  font-size: 14.5px;
  color: var(--faint);
  line-height: 1.75;
}
.landing-cta-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.landing-paths {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.lp-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border-radius: 18px;
  border: 1px solid var(--line2);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
}
.lp-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}
.lp-card.lp-primary { border-top: 3px solid var(--accent); }
.lp-card.lp-general { border-top: 3px solid #7c3aed; }
.lp-card.lp-extras { border-top: 3px solid #059669; }
.lp-kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--faint);
}
.lp-card h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.015em;
}
.lp-ar, .bc-ar, .beyond-ar-title {
  font-family: "Cairo", system-ui, sans-serif;
  font-size: 13.5px;
  color: var(--sub);
  line-height: 1.6;
}
.beyond-ar-title { margin: 4px 0 6px; font-size: 15px; }
.lp-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.lp-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
}
.landing-quick {
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid var(--line2);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.landing-quick-lbl {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--faint);
}
.landing-quick-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.landing-qchip {
  border: 1px solid var(--line2);
  background: var(--card2);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 13px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease;
}
.landing-qchip:hover { border-color: var(--accent); color: var(--accent-text); }

.beyond-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.beyond-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line2);
  background: var(--surface);
  cursor: pointer;
  min-width: 0;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.beyond-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.beyond-card h3 { margin: 4px 0 0; font-size: 16.5px; }
.bc-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.bc-foot { margin-top: auto; padding-top: 8px; }

.extra-link-card {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px dashed var(--line);
  background: var(--card2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.elc-body { flex: 1 1 240px; min-width: 0; }
.elc-kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #059669;
  margin-bottom: 3px;
}
.elc-title {
  display: block;
  font-size: 14.5px;
  color: var(--ink);
  margin-bottom: 2px;
}
.elc-sub { margin: 0; }

.return-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

html[data-theme="dark"] .lp-card,
html[data-theme="dark"] .landing-quick,
html[data-theme="dark"] .beyond-card {
  background: var(--surface);
  border-color: var(--line);
}
html[data-theme="dark"] .extra-link-card {
  background: var(--card2);
  border-color: var(--line);
}
html[data-theme="dark"] .elc-kicker { color: #34d399; }

@media (max-width: 900px) {
  .landing-paths { grid-template-columns: minmax(0, 1fr); }
  .beyond-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .landing-nav { padding: 8px 12px; }
  .landing-main { padding: 12px 14px 48px; }
  .landing-hero { padding: 24px 16px; }
}

.coming-soon-card {
  text-align: center;
  padding: 44px 24px;
  margin-top: 18px;
  border-radius: 20px;
  border: 1px dashed var(--line);
  background: var(--surface);
}
.coming-soon-card h1 {
  margin: 4px auto 10px;
  font-size: clamp(1.45rem, 2.8vw, 2.1rem);
}
.coming-soon-card .lede {
  max-width: 580px;
  margin: 0 auto 22px;
}
html[data-theme="dark"] .coming-soon-card {
  background: var(--surface);
  border-color: var(--line);
}


/* ---------- P3: Sticky Topic Mini-Nav & Code Explainer ---------- */
.step-pill, .video-slot {
  scroll-margin-top: 118px;
}
.topic-mini-nav {
  position: sticky;
  top: 62px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 8px;
  margin: 10px 0 14px;
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
body.kb-open .topic-mini-nav {
  display: none !important;
}
.topic-mini-btn {
  flex: 1 0 auto;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--sub);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.topic-mini-btn:hover {
  background: var(--card);
  color: var(--ink);
}
.topic-mini-btn.on {
  background: var(--btn-dark-bg);
  color: var(--btn-dark-ink);
}
.code-card-acts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.code-explain-box {
  padding: 12px 14px;
  background: var(--card2);
  border-top: 1px solid var(--line2);
  color: var(--ink);
  font-size: 13.5px;
}
.code-explain-list {
  margin: 0 0 10px;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

/* ---------- P4: SVG Analogies, Flashcards, Drag-Drop & Before/After CSS ---------- */
.analogy-svg-wrap {
  margin: 10px 0 6px;
  padding: 8px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line2);
  color: var(--ink);
}
.fc-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 16px 0 24px;
}
.fc-card {
  width: 100%;
  min-height: 220px;
  padding: 24px 20px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}
.fc-card.flipped {
  border-color: var(--accent);
  background: var(--card2);
}
.fc-kicker {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-text);
}
.fc-term {
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 800;
  color: var(--ink);
}
.fc-ar {
  font-family: "Cairo", system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  direction: rtl;
  line-height: 1.7;
}
.fc-en-def {
  max-width: 540px;
  margin: 6px auto 0;
}
.fc-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.fc-controls .btn {
  min-height: 44px;
  justify-content: center;
}

.dnd-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}
.dnd-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--surface);
}
.dnd-row.sel { border-color: var(--accent); background: var(--accent-soft); }
.dnd-row.right { border-color: var(--green); background: var(--green-bg); }
.dnd-row.wrong { border-color: var(--red); background: var(--red-bg); }
.dnd-num {
  width: 24px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--sub);
  flex: none;
}
.dnd-code {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 8px;
  overflow-x: auto;
}
.dnd-move-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card2);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  flex: none;
}
.dnd-move-btn:disabled { opacity: 0.4; cursor: default; }

.ba-stage {
  position: relative;
  min-height: 190px;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #f8fafc;
  color: #0f172a;
  margin: 12px 0;
}
.ba-pane {
  position: absolute;
  inset: 0;
  padding: 36px 14px 14px;
  overflow: auto;
}
.ba-before { background: #ffffff; color: #0f172a; }
.ba-after { background: #f1f5f9; color: #0f172a; }
.ba-label {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: #0f172a;
  color: #ffffff;
}
.ba-label-r { left: auto; right: 10px; background: #047857; }
.ba-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #0062c4;
  pointer-events: none;
}
.ba-range {
  width: 100%;
  min-height: 44px;
  margin: 6px 0;
}
@media (max-width: 720px) {
  .topic-mini-nav { top: 60px; border-radius: 0; margin: 8px -14px 12px; border-left: 0; border-right: 0; }
}

/* ---------- Optional Advanced Beyond-the-Book Card (Distinct Violet/Amber Theme) ---------- */
.lesson-adv-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 34px 0 14px;
  color: #7c3aed;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.lesson-adv-sep::before,
.lesson-adv-sep::after {
  content: '';
  flex: 1;
  border-top: 1.5px dashed rgba(124, 58, 237, 0.35);
}
.lesson-adv-card {
  background: linear-gradient(135deg, #f5f3ff 0%, #fffbeb 100%);
  border: 2px solid #c4b5fd;
  border-radius: 16px;
  margin-bottom: 22px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(109, 40, 217, 0.08);
}
.lesson-adv-tgl {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 18px 20px;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.lesson-adv-tgl:hover {
  background: rgba(124, 58, 237, 0.05);
}
.lesson-adv-head {
  flex: 1 1 280px;
  min-width: 0;
}
.lesson-adv-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.lesson-adv-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #5b21b6;
  background: rgba(124, 58, 237, 0.14);
  padding: 3px 9px;
  border-radius: 999px;
}
.lesson-adv-badge-ar {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  color: #92400e;
  background: rgba(245, 158, 11, 0.18);
  padding: 2px 10px;
  border-radius: 999px;
  font-family: 'Cairo', sans-serif;
}
.lesson-adv-title {
  margin: 2px 0 4px;
  font-size: 1.08rem;
  color: #2e1065;
}
.lesson-adv-sub {
  margin: 0 0 10px;
  font-size: 13.5px;
  color: #4c1d95;
  opacity: 0.85;
}
.lesson-adv-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lesson-adv-pill {
  font-size: 12px;
  font-weight: 600;
  color: #5b21b6;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  padding: 3px 9px;
}
.lesson-adv-chev {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #6d28d9;
  padding: 8px 14px;
  border-radius: 10px;
  white-space: nowrap;
}
.lesson-adv-body {
  padding: 4px 20px 20px;
  display: grid;
  gap: 14px;
  border-top: 1px dashed rgba(124, 58, 237, 0.25);
}
.lesson-adv-item {
  background: #ffffff;
  border: 1px solid #ddd6fe;
  border-left: 4px solid #7c3aed;
  border-radius: 12px;
  padding: 14px 16px;
}
.lesson-adv-item h4 {
  margin: 6px 0 6px;
  color: var(--ink);
}
.lesson-adv-num {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #6d28d9;
}
html[data-theme="dark"] .lesson-adv-sep { color: #c4b5fd; }
html[data-theme="dark"] .lesson-adv-card {
  background: linear-gradient(135deg, rgba(109, 40, 217, 0.18) 0%, rgba(180, 83, 9, 0.12) 100%);
  border-color: rgba(167, 139, 250, 0.45);
}
html[data-theme="dark"] .lesson-adv-badge { color: #ddd6fe; background: rgba(139, 92, 246, 0.28); }
html[data-theme="dark"] .lesson-adv-badge-ar { color: #fde68a; background: rgba(245, 158, 11, 0.22); }
html[data-theme="dark"] .lesson-adv-title { color: #f5f3ff; }
html[data-theme="dark"] .lesson-adv-sub { color: #ddd6fe; }
html[data-theme="dark"] .lesson-adv-pill { background: rgba(30, 27, 75, 0.7); border-color: rgba(167, 139, 250, 0.35); color: #e9d5ff; }
html[data-theme="dark"] .lesson-adv-item { background: var(--card); border-color: rgba(167, 139, 250, 0.3); border-left-color: #a78bfa; }
html[data-theme="dark"] .lesson-adv-num { color: #c4b5fd; }
