/* ================================================================
   AWS Lambda Notes — Modern Enterprise Dark Theme
   Inspired by Linear, Vercel, GitHub Dark, Radix UI
   ================================================================ */

:root {
  --bg: #09090b;
  --surface: #111113;
  --card: #18181b;
  --border: #27272a;
  --border-light: #3f3f46;
  --text: #fafafa;
  --muted: #a1a1aa;
  --dim: #52525b;
  --accent: #6366f1;
  --accent2: #818cf8;
  --accent3: #a5b4fc;
  --green: #22c55e;
  --amber: #f59e0b;
  --coral: #f97316;
  --pink: #ec4899;
  --teal: #14b8a6;
  --sidebar-width: 272px;
  --header-height: 52px;
  --topbar-height: 40px;
}

/* ── Light Mode Overrides ───────────────────────────────── */
.light {
  --bg:           #fafaf9;
  --surface:      #f4f4f5;
  --card:         #ffffff;
  --border:       #e4e4e7;
  --border-light: #d4d4d8;
  --text:         #09090b;
  --muted:        #52525b;
  --dim:          #a1a1aa;
  --green-text:   #15803d;
  --amber-text:   #b45309;
  --teal-text:    #0f766e;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ── Site Top Navigation Bar ────────────────────────────── */
.site-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  z-index: 300;
}

.topbar-inner {
  display: flex;
  align-items: center;
  padding: 0 16px;
  width: 100%;
  height: 100%;
  gap: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 16px;
}

.topbar-logo-mark {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.topbar-logo-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.topbar-bc-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  transition: color .12s;
}

.topbar-bc-link:hover { color: var(--text); }

.topbar-bc-sep {
  font-size: 12px;
  color: var(--dim);
}

.topbar-bc-current {
  font-size: 12px;
  color: var(--accent3);
  font-weight: 500;
}

.topbar-request {
  font-size: 11px;
  font-weight: 500;
  color: var(--accent3);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 5px;
  margin-left: 12px;
  transition: background .12s, border-color .12s;
  flex-shrink: 0;
}

.topbar-request:hover {
  background: rgba(99,102,241,0.08);
  border-color: rgba(99,102,241,0.5);
}

.topbar-theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 3px 8px;
  margin-left: auto;
  transition: border-color .12s, color .12s;
}

.topbar-theme-toggle:hover { color: var(--text); border-color: var(--border-light); }

/* ── Theme icon swap ────────────────────────────────────── */
.icon-light { display: none; }
.icon-dark  { display: inline; }
.light .icon-dark  { display: none; }
.light .icon-light { display: inline; }

/* ── Header ─────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: var(--topbar-height); left: 0; right: 0;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 200;
  gap: 12px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.logo-icon {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.header-sep { width: 1px; height: 20px; background: var(--border); }

.header-badge {
  padding: 2px 8px;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.22);
  border-radius: 4px;
  font-size: 11px;
  color: var(--accent3);
  font-weight: 500;
  white-space: nowrap;
}

.header-breadcrumb {
  margin-left: auto;
  font-size: 12px;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-breadcrumb .bc-active { color: var(--muted); }

/* ── Layout ──────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: calc(100vh - var(--topbar-height));
  margin-top: var(--topbar-height);
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: calc(100vh - var(--topbar-height));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#toc-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 8px;
}

#toc-nav::-webkit-scrollbar { width: 3px; }
#toc-nav::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
#toc-nav::-webkit-scrollbar-track { background: transparent; }

.sidebar-label {
  padding: 10px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 6px;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0;
  transition: width 0.3s ease;
}

/* TOC items */
.toc-item { position: relative; }

.toc-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s ease;
  user-select: none;
  border-left: 2px solid transparent;
  text-decoration: none;
}

.toc-header:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}

.toc-header.active {
  color: var(--text);
  border-left-color: var(--accent);
  background: rgba(99,102,241,0.08);
}

.toc-icon { font-size: 12px; flex-shrink: 0; }
.toc-label { flex: 1; }

.toc-chevron {
  font-size: 9px;
  color: var(--dim);
  transition: transform 0.12s ease;
  flex-shrink: 0;
}

.toc-item.open .toc-chevron { transform: rotate(90deg); }

.toc-subs {
  display: none;
  padding: 1px 0 4px;
}

.toc-item.open .toc-subs { display: block; }

.toc-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px 5px 36px;
  cursor: pointer;
  color: var(--dim);
  font-size: 12px;
  transition: all 0.12s ease;
  border-left: 2px solid transparent;
  text-decoration: none;
}

.toc-sub:hover { color: var(--muted); background: rgba(255,255,255,0.02); }

.toc-sub.active {
  color: var(--accent3);
  border-left-color: var(--accent);
  background: rgba(99,102,241,0.06);
}

.toc-sub::before {
  content: '·';
  color: var(--dim);
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.toc-sub.active::before { color: var(--accent); }

/* ── Main Content ────────────────────────────────────── */
.main-content {
  flex: 1;
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 48px;
}

.main-content::-webkit-scrollbar { width: 5px; }
.main-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
/* ── Main Header Breadcrumb ─────────────────────────────── */
.main-header {
  padding: 16px 48px 0;
  max-width: 960px;
  margin: 0 auto;
}

.breadcrumb {
  font-size: 12px;
  color: var(--dim);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.breadcrumb .bc-active { color: var(--muted); }
/* ── Content Container ───────────────────────────────── */
.content-container { max-width: 960px; margin: 0 auto; padding: 24px 48px 0; }

.page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 32px;
  max-width: 720px;
}

.section-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 40px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-icon { font-size: 15px; }

.subsection-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 10px;
}

.body-text {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 14px;
}

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-desc { font-size: 13px; color: var(--muted); line-height: 1.7; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.card-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 18px 0;
}

.card-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0;
}

/* ── Stat Cards ──────────────────────────────────────── */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ── Callouts ─────────────────────────────────────────── */
.callout {
  display: flex;
  gap: 11px;
  padding: 13px 15px;
  border-radius: 7px;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.65;
}

.callout-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.callout-body { flex: 1; }
.callout-title { font-weight: 600; margin-bottom: 3px; font-size: 13px; }

.callout.info    { background: rgba(99,102,241,0.07);  border: 1px solid rgba(99,102,241,0.18);  color: #c7d2fe; }
.callout.info    .callout-title { color: var(--accent2); }
.callout.warning { background: rgba(245,158,11,0.07);  border: 1px solid rgba(245,158,11,0.2);   color: #fde68a; }
.callout.warning .callout-title { color: var(--amber); }
.callout.tip     { background: rgba(34,197,94,0.07);   border: 1px solid rgba(34,197,94,0.18);   color: #bbf7d0; }
.callout.tip     .callout-title { color: var(--green); }
.callout.danger  { background: rgba(249,115,22,0.07);  border: 1px solid rgba(249,115,22,0.18);  color: #fed7aa; }
.callout.danger  .callout-title { color: var(--coral); }
.callout.exam    { background: rgba(236,72,153,0.07);  border: 1px solid rgba(236,72,153,0.18);  color: #fce7f3; }
.callout.exam    .callout-title { color: var(--pink); }

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-accent { background: rgba(99,102,241,0.14);  color: var(--accent3);  border: 1px solid rgba(99,102,241,0.22); }
.badge-green  { background: rgba(34,197,94,0.1);    color: #86efac;         border: 1px solid rgba(34,197,94,0.2); }
.badge-amber  { background: rgba(245,158,11,0.1);   color: #fde68a;         border: 1px solid rgba(245,158,11,0.2); }
.badge-coral  { background: rgba(249,115,22,0.1);   color: #fed7aa;         border: 1px solid rgba(249,115,22,0.2); }
.badge-teal   { background: rgba(20,184,166,0.1);   color: #99f6e4;         border: 1px solid rgba(20,184,166,0.2); }
.badge-pink   { background: rgba(236,72,153,0.1);   color: #f9a8d4;         border: 1px solid rgba(236,72,153,0.2); }
.badge-dim    { background: rgba(82,82,91,0.18);     color: var(--muted);    border: 1px solid var(--border); }

/* ── Tables ──────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 13px; }

.data-table th {
  text-align: left;
  padding: 9px 13px;
  background: rgba(255,255,255,0.025);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 9px 13px;
  color: var(--muted);
  border-bottom: 1px solid rgba(39,39,42,0.5);
  vertical-align: top;
  line-height: 1.6;
}

.data-table tr:hover td { background: rgba(255,255,255,0.015); }
.data-table td:first-child { color: var(--text); font-weight: 500; }

/* ── Code ────────────────────────────────────────────── */
code {
  font-family: 'Cascadia Code', 'Consolas', 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--accent3);
}

pre {
  background: #0c0c0e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  overflow-x: auto;
  margin: 14px 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 12.5px;
  color: #e2e8f0;
  line-height: 1.75;
}

.hl-keyword  { color: #c792ea; }
.hl-string   { color: #c3e88d; }
.hl-comment  { color: #546e7a; font-style: italic; }
.hl-number   { color: #f78c6c; }
.hl-fn       { color: #82aaff; }
.hl-type     { color: #ffcb6b; }
.hl-const    { color: #f78c6c; }

/* ── Flow Diagrams ───────────────────────────────────── */
.arch-diagram {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 24px;
  margin: 18px 0;
  overflow-x: auto;
}

.arch-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 18px;
}

.flow {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.flow-node {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.flow-node.accent { border-color: rgba(99,102,241,0.5);  color: var(--accent3);  background: rgba(99,102,241,0.08); }
.flow-node.green  { border-color: rgba(34,197,94,0.4);   color: #86efac;         background: rgba(34,197,94,0.07); }
.flow-node.amber  { border-color: rgba(245,158,11,0.4);  color: #fde68a;         background: rgba(245,158,11,0.07); }
.flow-node.coral  { border-color: rgba(249,115,22,0.4);  color: #fed7aa;         background: rgba(249,115,22,0.07); }
.flow-node.teal   { border-color: rgba(20,184,166,0.4);  color: #99f6e4;         background: rgba(20,184,166,0.07); }
.flow-node.pink   { border-color: rgba(236,72,153,0.4);  color: #f9a8d4;         background: rgba(236,72,153,0.07); }

.flow-arrow { color: var(--dim); font-size: 16px; line-height: 1; }

/* ── Tabs ─────────────────────────────────────────────── */
.tabs-wrap { margin: 18px 0; }

.tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  margin-bottom: -1px;
  font-family: inherit;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Expandable ──────────────────────────────────────── */
.expand-block {
  border: 1px solid var(--border);
  border-radius: 7px;
  margin-bottom: 8px;
  overflow: hidden;
}

.expand-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 15px;
  cursor: pointer;
  background: var(--card);
  transition: background 0.12s ease;
}

.expand-head:hover { background: rgba(255,255,255,0.03); }

.expand-head-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}

.expand-chevron {
  color: var(--dim);
  font-size: 10px;
  transition: transform 0.12s ease;
}

.expand-block.open .expand-chevron { transform: rotate(90deg); }

.expand-body {
  display: none;
  padding: 15px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.expand-block.open .expand-body { display: block; }

/* ── Lists ────────────────────────────────────────────── */
.feat-list { list-style: none; padding: 0; margin: 10px 0; }

.feat-list li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.feat-list li::before {
  content: '▸';
  color: var(--accent);
  font-size: 10px;
  flex-shrink: 0;
  margin-top: 4px;
}

.check-list { list-style: none; padding: 0; margin: 10px 0; }

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.check-list li::before {
  content: '✓';
  color: var(--green);
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Timeline ─────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 22px;
  margin: 14px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: var(--border);
}

.tl-item {
  position: relative;
  margin-bottom: 18px;
}

.tl-item::before {
  content: '';
  position: absolute;
  left: -18px;
  top: 5px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.tl-item.green::before { background: var(--green); }
.tl-item.amber::before { background: var(--amber); }
.tl-item.coral::before { background: var(--coral); }

.tl-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.tl-desc  { font-size: 12.5px; color: var(--muted); line-height: 1.65; }

/* ── Compare bars ─────────────────────────────────────── */
.cmp-bar { margin: 8px 0; }

.cmp-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}

.cmp-track {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.cmp-fill {
  height: 100%;
  border-radius: 3px;
  width: 0;
  transition: width 0.5s ease;
}

/* ── KV list ──────────────────────────────────────────── */
.kv-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 18px;
  margin: 12px 0;
  align-items: baseline;
}

.kv-k { font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.kv-v { font-size: 13px; color: var(--text); }

/* ── Divider ──────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 28px 0; }

/* ── Tag row ──────────────────────────────────────────── */
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }

/* ── Loading ──────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--dim);
  font-size: 13px;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1100px) {
  .card-3col { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .card-2col, .card-3col { grid-template-columns: 1fr; }
  .main-content { padding: 24px 20px; }
  .sidebar { width: 240px; }
}

/* ── Light Mode: hover overrides (rgba white → rgba black) ── */
.toc-header:hover        { background: rgba(255,255,255,0.03); }
.light .toc-header:hover { background: rgba(0,0,0,0.04); }

.toc-sub:hover        { background: rgba(255,255,255,0.02); }
.light .toc-sub:hover { background: rgba(0,0,0,0.02); }

.data-table tr:hover td        { background: rgba(255,255,255,0.015); }
.light .data-table tr:hover td { background: rgba(0,0,0,0.02); }

.expand-head:hover        { background: rgba(255,255,255,0.03); }
.light .expand-head:hover { background: rgba(0,0,0,0.03); }

/* ── Light Mode: keep code blocks dark ─────────────────── */
.light pre                { background: #18181b; border-color: #27272a; }
.light pre code           { color: #e2e8f0; }
.light .arch-diagram      { background: #18181b; border-color: #27272a; }
.light code               { background: rgba(0,0,0,0.06); border-color: #d4d4d8; color: var(--accent); }

/* ── Difficulty Badge ─────────────────────────────────── */
.topic-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.difficulty-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.difficulty-beginner     { background: rgba(34,197,94,0.1);   color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
.difficulty-intermediate { background: rgba(99,102,241,0.1);  color: var(--accent3); border: 1px solid rgba(99,102,241,0.25); }
.difficulty-advanced     { background: rgba(249,115,22,0.1);  color: #fed7aa; border: 1px solid rgba(249,115,22,0.25); }
.difficulty-mixed        { background: rgba(20,184,166,0.1);  color: #99f6e4; border: 1px solid rgba(20,184,166,0.25); }

/* ── Subtopic Navigation ────────────────────────────── */
.subtopic-nav-wrap { max-width: 960px; margin: 32px auto 0; padding: 0 48px; }

.subtopic-nav {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 0;
  background: var(--card);
}

.subtopic-nav-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 10px;
}

.subtopic-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.subtopic-nav-link {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.12s ease;
}

.subtopic-nav-link:hover { color: var(--text); border-color: var(--border-light); }
.subtopic-nav-link.active { color: var(--accent3); background: rgba(99,102,241,0.09); border-color: rgba(99,102,241,0.35); }

.topic-nav-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.topic-nav-prev, .topic-nav-next {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.12s;
}

.topic-nav-prev:hover, .topic-nav-next:hover { color: var(--accent); }
.topic-nav-next { margin-left: auto; }

/* ── Stat Grid ────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

/* ── Service Overview Cards (Landing Page) ─────────────── */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.service-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
  text-decoration: none;
  display: block;
}

.service-card:hover {
  border-color: rgba(99,102,241,0.4);
  box-shadow: 0 0 0 1px rgba(99,102,241,0.1);
}

.service-card-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.service-card-icon { font-size: 18px; }

.service-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.service-card-stars {
  margin-left: auto;
  font-size: 10px;
  color: var(--amber);
}

.service-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}

.service-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.service-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(99,102,241,0.09);
  color: var(--accent3);
  border: 1px solid rgba(99,102,241,0.2);
}

/* ── Accent left-border sections ────────────────────────── */
.insight-box {
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  background: rgba(99,102,241,0.05);
  border-radius: 0 7px 7px 0;
  margin: 16px 0;
}

.insight-box.green  { border-left-color: var(--green); background: rgba(34,197,94,0.05); }
.insight-box.amber  { border-left-color: var(--amber); background: rgba(245,158,11,0.05); }
.insight-box.coral  { border-left-color: var(--coral); background: rgba(249,115,22,0.05); }
.insight-box.teal   { border-left-color: var(--teal);  background: rgba(20,184,166,0.05); }

/* ── Step list ────────────────────────────────────────── */
.step-list { list-style: none; padding: 0; margin: 12px 0; counter-reset: step-counter; }

.step-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  border-bottom: 1px solid rgba(39,39,42,0.4);
  counter-increment: step-counter;
}

.step-list li::before {
  content: counter(step-counter);
  background: rgba(99,102,241,0.15);
  color: var(--accent3);
  border: 1px solid rgba(99,102,241,0.25);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Quiz Component ──────────────────────────────────── */
.quiz-question {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.quiz-q {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.6;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 12px;
}

.quiz-opt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
}

.quiz-opt:hover { border-color: var(--border-light); color: var(--text); }
.quiz-opt.correct { border-color: var(--green); color: #86efac; background: rgba(34,197,94,0.07); }
.quiz-opt.wrong   { border-color: #f97316; color: #fed7aa; background: rgba(249,115,22,0.07); }

.quiz-question.answered .quiz-opt { cursor: not-allowed; pointer-events: none; }

.quiz-explain {
  display: none;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
  padding: 10px 14px;
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 6px;
}

.quiz-question.answered .quiz-explain { display: block; }
