/* =========================================================
   PROTOCOL LAB — stylesheet
   A modern dark-themed learning UI.
   No frameworks; vanilla CSS with custom properties.
   ========================================================= */

/* ---------- 1. Reset & roots ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }

:root {
  /* palette */
  --bg-0:        #0a0b14;
  --bg-1:        #0f1020;
  --bg-2:        #14152a;
  --surface:     #1a1c36;
  --surface-2:   #21243f;
  --line:        rgba(255,255,255,0.08);
  --line-strong: rgba(255,255,255,0.16);

  --text:        #e8e9f3;
  --text-dim:    #a8acc7;
  --text-mute:   #6f7393;

  --accent:      #7c5cff;
  --accent-2:    #00d4ff;
  --accent-3:    #ff5ca8;
  --accent-warn: #ffb547;
  --accent-ok:   #4ade80;
  --accent-err:  #ff6b6b;

  --rest:        #ffb547;
  --mcp:         #7c5cff;

  --gradient:    linear-gradient(135deg, #7c5cff 0%, #00d4ff 100%);
  --gradient-2:  linear-gradient(135deg, #ff5ca8 0%, #7c5cff 100%);
  --gradient-3:  linear-gradient(135deg, #ffb547 0%, #ff5ca8 100%);

  /* sizing */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;
  --shadow-1:  0 4px 20px rgba(0,0,0,0.25);
  --shadow-2:  0 14px 50px rgba(0,0,0,0.45);

  --sidebar-w: 260px;
  --topbar-h:  64px;
}

/* ---------- 2. Body & ambient ---------- */
body {
  background: var(--bg-0);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 50%, transparent 95%);
}
.bg-glow {
  position: fixed; pointer-events: none; z-index: 0;
  width: 700px; height: 700px; border-radius: 50%;
  filter: blur(140px); opacity: 0.32;
}
.bg-glow--a { background: #7c5cff; top: -200px; right: -200px; }
.bg-glow--b { background: #00d4ff; bottom: -260px; left: -260px; opacity: 0.22; }

/* ---------- 3. Typography ---------- */
h1, h2, h3, h4 {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.18;
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }
p  { margin: 0 0 1em; color: var(--text-dim); }
p strong, li strong { color: var(--text); }
code, pre {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875rem;
}
:not(pre) > code {
  background: rgba(124, 92, 255, 0.12);
  border: 1px solid rgba(124, 92, 255, 0.25);
  color: #c8b8ff;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.82em;
}
pre {
  background: #0a0b14;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  color: #d8d9e8;
  margin: 0;
  line-height: 1.6;
}
pre code { background: none; padding: 0; border: 0; color: inherit; }
a { color: var(--accent-2); text-decoration: none; transition: color .15s; }
a:hover { color: #66e7ff; }

.grad-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.muted { color: var(--text-mute); }

/* ---------- 4. Top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 50;
  background: rgba(10, 11, 20, 0.72);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: 1500px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand__text { font-size: 1rem; }
.brand__text em { font-style: normal; color: var(--text-dim); font-weight: 500; }
.brand__mark { display: flex; }

.topnav {
  display: flex; gap: 2px; justify-self: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 999px;
}
.topnav a {
  color: var(--text-dim);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background .2s, color .2s;
}
.topnav a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.topnav a.is-active {
  color: #fff;
  background: var(--gradient);
  box-shadow: 0 4px 18px rgba(124,92,255,0.4);
}

.topbar__meta { display: flex; align-items: center; gap: 12px; }
.progress {
  position: relative;
  width: 120px; height: 28px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.progress__fill {
  position: absolute; inset: 0;
  background: var(--gradient);
  width: 0%;
  transition: width .4s cubic-bezier(.2,.8,.2,1);
}
.progress__label {
  position: relative;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  z-index: 1;
}

/* ---------- 5. Layout shell ---------- */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  max-width: 1500px;
  margin: 0 auto;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

/* ---------- 6. Sidebar ---------- */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 28px 20px 60px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: #2a2c4a transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #2a2c4a; border-radius: 3px; }
.sidebar__group + .sidebar__group { margin-top: 26px; }
.sidebar__heading {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  font-weight: 700;
  margin-bottom: 10px;
  padding: 0 10px;
}
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-dim);
  transition: background .15s, color .15s;
  position: relative;
}
.sidebar li a:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.sidebar li a.is-active {
  color: #fff;
  background: rgba(124,92,255,0.14);
}
.sidebar li a.is-active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; background: var(--gradient); border-radius: 2px;
}
.sidebar li a .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-mute);
  transition: background .15s;
}
.sidebar li a:hover .dot { background: var(--accent-2); }
.sidebar li a.is-active .dot { background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }
.sidebar li a.is-done .dot { background: var(--accent-ok); box-shadow: 0 0 6px var(--accent-ok); }

/* ---------- 7. Content area ---------- */
.content {
  padding: 60px 64px 120px;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
}
.section { padding: 50px 0; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; padding-top: 30px; }
.section__head { margin-bottom: 28px; }
.section__lead { color: var(--text-dim); margin-top: 6px; max-width: 65ch; }

.eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-2);
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0,212,255,0.08);
  border: 1px solid rgba(0,212,255,0.2);
  margin-bottom: 14px;
}
.eyebrow--rest   { color: var(--rest); background: rgba(255,181,71,0.08); border-color: rgba(255,181,71,0.25); }
.eyebrow--mcp    { color: var(--mcp);  background: rgba(124,92,255,0.1);  border-color: rgba(124,92,255,0.25); }
.eyebrow--accent { color: var(--accent-3); background: rgba(255,92,168,0.08); border-color: rgba(255,92,168,0.25); }

/* ---------- 8. Hero ---------- */
.hero {
  padding: 40px 0 50px;
  text-align: left;
}
.hero__title { margin-bottom: 20px; max-width: 18ch; }
.hero__lead {
  font-size: 1.15rem;
  color: var(--text-dim);
  max-width: 60ch;
  margin-bottom: 32px;
}
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 48px; }
.hero__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 22px 28px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.hero__stats > div {
  display: flex; flex-direction: column; gap: 2px;
}
.hero__stats b {
  font-size: 1.6rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__stats span { font-size: 0.8rem; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- 9. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, color .2s;
  user-select: none;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-color: var(--line);
}
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.07); }
.btn:active { transform: translateY(0); }
.btn--primary {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(124,92,255,0.35);
}
.btn--primary:hover { box-shadow: 0 12px 32px rgba(124,92,255,0.5); background: var(--gradient); }
.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text-dim);
}
.btn--ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }
.btn--sm { padding: 6px 14px; font-size: 0.8rem; }

.check-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 28px;
  padding: 10px 18px;
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.3);
  color: var(--accent-ok);
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all .2s;
}
.check-btn:hover { background: rgba(74,222,128,0.16); transform: translateY(-1px); }
.check-btn.is-done {
  background: rgba(74,222,128,0.2);
  border-color: rgba(74,222,128,0.5);
}

/* ---------- 10. Cards ---------- */
.cards { display: grid; gap: 18px; margin: 26px 0; }
.cards--2 { grid-template-columns: repeat(2, 1fr); }
.cards--3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  position: relative;
  overflow: hidden;
  transition: transform .25s, border-color .2s, box-shadow .25s;
}
.card--hover:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-1);
}
.card--accent { background: linear-gradient(180deg, rgba(124,92,255,0.06), rgba(255,255,255,0.005)); }
.card h3, .card h4 { margin-top: 0; }
.card__pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--rest);
  background: rgba(255,181,71,0.1);
  border: 1px solid rgba(255,181,71,0.25);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.card__pill--alt    { color: var(--mcp);     background: rgba(124,92,255,0.1);  border-color: rgba(124,92,255,0.3); }
.card__pill--accent { color: var(--accent-3); background: rgba(255,92,168,0.1);  border-color: rgba(255,92,168,0.3); }
.card__link {
  display: inline-block;
  margin-top: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--accent-2);
}
.card p { font-size: 0.95rem; }
.card pre { margin-top: 14px; font-size: 0.78rem; }

/* ---------- 11. Defs ---------- */
.defs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 18px 0;
}
.defs--3 { grid-template-columns: repeat(3, 1fr); }
.def {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.def b {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 0.95rem;
}
.def span { color: var(--text-dim); font-size: 0.88rem; }

/* ---------- 12. Callout ---------- */
.callout {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  margin: 22px 0;
}
.callout--mcp { border-left-color: var(--mcp); }
.callout__icon { font-size: 1.3rem; line-height: 1.6; }
.callout div + div { color: var(--text-dim); font-size: 0.95rem; }
.callout div + div b { color: var(--text); }

/* ---------- 13. Examples & code blocks ---------- */
.example {
  margin: 18px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #07080f;
}
.example__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  background: rgba(255,255,255,0.025);
  border-bottom: 1px solid var(--line);
}
.example__title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.copy-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  transition: all .15s;
}
.copy-btn:hover { color: var(--text); border-color: var(--accent-2); }
.copy-btn.copied { color: var(--accent-ok); border-color: var(--accent-ok); }
.example pre { border: 0; border-radius: 0; background: transparent; }

/* ---------- 14. Accordion ---------- */
.accordion { display: flex; flex-direction: column; gap: 8px; }
.acc {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s;
}
.acc[open] { border-color: rgba(124,92,255,0.4); background: rgba(124,92,255,0.04); }
.acc summary {
  list-style: none;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
  position: relative;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after {
  content: "+";
  position: absolute; right: 22px;
  font-size: 1.4rem;
  color: var(--text-mute);
  transition: transform .25s, color .2s;
}
.acc[open] summary::after { transform: rotate(45deg); color: var(--accent-2); }
.acc .num {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gradient);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.8rem;
}
.acc__hint {
  margin-left: auto; margin-right: 36px;
  color: var(--text-mute);
  font-size: 0.85rem;
  font-weight: 400;
}
.acc__body {
  padding: 0 18px 18px 60px;
  color: var(--text-dim);
}
.acc__body p { margin: 0; }

/* ---------- 15. HTTP method pills ---------- */
.m {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.m--get   { background: rgba(74,222,128,0.15);  color: #6fe89c; border: 1px solid rgba(74,222,128,0.3); }
.m--post  { background: rgba(124,92,255,0.18);  color: #b8a7ff; border: 1px solid rgba(124,92,255,0.35); }
.m--put   { background: rgba(255,181,71,0.18);  color: #ffc977; border: 1px solid rgba(255,181,71,0.35); }
.m--patch { background: rgba(0,212,255,0.16);   color: #66e7ff; border: 1px solid rgba(0,212,255,0.3); }
.m--del   { background: rgba(255,107,107,0.16); color: #ff8c8c; border: 1px solid rgba(255,107,107,0.3); }
.m--head    { background: rgba(255,255,255,0.06); color: #d8d9e8; border: 1px solid var(--line); }
.m--opt     { background: rgba(255,255,255,0.06); color: #d8d9e8; border: 1px solid var(--line); }
.m--trace   { background: rgba(180,130,255,0.12); color: #c5a8ff; border: 1px solid rgba(180,130,255,0.3); }
.m--connect { background: rgba(120,200,180,0.12); color: #8ed8c5; border: 1px solid rgba(120,200,180,0.3); }

.muted-sm { color: var(--text-muted, #9aa0b4); font-size: 0.86rem; margin-top: 6px; }

/* ---------- Learning UI extras ---------- */
.learn-tips {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.learn-tip {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #c6c8da;
}
.learn-tip b { color: #fff; }
.learn-tip kbd {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.16);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #e9ecf7;
}
@media (max-width: 720px) {
  .learn-tips { grid-template-columns: 1fr; }
}

.learn-objectives {
  margin: 14px 0 22px;
  background: linear-gradient(180deg, rgba(124,92,255,0.08), rgba(0,212,255,0.04));
  border: 1px solid rgba(124,92,255,0.22);
  border-radius: 14px;
  padding: 14px 18px;
}
.learn-objectives b { color: #fff; }
.learn-objectives ul {
  margin: 8px 0 0 22px;
  padding: 0;
  color: #c6c8da;
}
.learn-objectives li { margin-bottom: 4px; }

.takeaway {
  margin: 22px 0 6px;
  background: rgba(0,212,255,0.06);
  border: 1px solid rgba(0,212,255,0.25);
  border-left: 4px solid #00d4ff;
  border-radius: 10px;
  padding: 12px 16px;
  position: relative;
}
.takeaway__pill {
  display: inline-block;
  background: linear-gradient(90deg, #7c5cff, #00d4ff);
  color: #0b0c14;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.takeaway p { margin: 0; color: #d8d9e8; line-height: 1.6; }

.cheats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 14px;
}
.cheat {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
}
.cheat h3 { margin: 0 0 10px; }
.cheat ul { margin: 0; padding-left: 18px; color: #c6c8da; }
.cheat li { margin-bottom: 6px; line-height: 1.55; }
.cheat--rest { border-left: 3px solid #6fe89c; }
.cheat--mcp  { border-left: 3px solid #b8a7ff; }
@media (max-width: 820px) {
  .cheats { grid-template-columns: 1fr; }
}

/* lesson nav (prev/next) */
.lesson-nav {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 14px;
  flex-wrap: wrap;
}
.lesson-nav__btn {
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  color: #e9ecf7;
  text-decoration: none;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}
.lesson-nav__btn:hover {
  transform: translateY(-1px);
  border-color: rgba(124,92,255,0.5);
  background: rgba(124,92,255,0.08);
}
.lesson-nav__btn--next { align-items: flex-end; text-align: right; }
.lesson-nav__btn span.dir {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9aa0b4;
}
.lesson-nav__btn b { font-size: 1rem; }
.lesson-nav__btn.is-ghost { opacity: 0.35; pointer-events: none; }

/* keyboard shortcuts dialog */
.kbd-modal {
  position: fixed;
  inset: 0;
  background: rgba(8,8,16,0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(8px);
}
.kbd-modal.is-open { display: flex; }
.kbd-modal__card {
  background: #14152a;
  border: 1px solid rgba(124,92,255,0.4);
  border-radius: 16px;
  padding: 22px 26px;
  max-width: 420px;
  width: calc(100% - 32px);
}
.kbd-modal__card h3 { margin: 0 0 14px; }
.kbd-modal__row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed rgba(255,255,255,0.06); }
.kbd-modal__row:last-child { border-bottom: 0; }
.kbd-modal kbd {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}
.kbd-modal__close {
  margin-top: 14px;
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: #fff;
  cursor: pointer;
}

/* back to top button */
.to-top {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c5cff, #00d4ff);
  color: #0b0c14;
  border: none;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(124,92,255,0.4);
}
.to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- 16. Method explorer ---------- */
.methods {
  margin: 22px 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
  background: rgba(255,255,255,0.02);
}
.methods__tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.methods__tabs::-webkit-scrollbar { display: none; }
.method-tab {
  flex: 0 0 auto;
  padding: 14px 18px;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  transition: background .15s;
}
.method-tab:hover { background: rgba(255,255,255,0.04); }
.method-tab.is-active { background: rgba(124,92,255,0.1); }
.methods__panel { padding: 24px 28px; }
.methods__panel h4 { margin-top: 0; color: var(--text); font-size: 1.1rem; }
.methods__panel .tags { display: flex; gap: 8px; margin: 6px 0 14px; flex-wrap: wrap; }
.methods__panel .tag {
  font-size: 0.74rem; padding: 3px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); color: var(--text-dim);
}
.methods__panel .tag.tag--ok  { color: var(--accent-ok);   border-color: rgba(74,222,128,0.4);  background: rgba(74,222,128,0.08); }
.methods__panel .tag.tag--no  { color: var(--accent-err);  border-color: rgba(255,107,107,0.4); background: rgba(255,107,107,0.08); }
.methods__panel pre { margin-top: 12px; font-size: 0.82rem; }

/* ---------- 17. Status tool ---------- */
.status-tool { margin: 24px 0; }
.status-tool__search {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 18px;
  padding: 20px 22px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  align-items: center;
  margin-bottom: 18px;
}
#statusInput {
  background: #0a0b14;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 14px;
  font-size: 1.4rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  text-align: center;
  width: 100%;
}
#statusInput:focus { border-color: var(--accent-2); outline: none; box-shadow: 0 0 0 3px rgba(0,212,255,0.18); }
.status-tool__readout { display: flex; flex-direction: column; gap: 4px; }
.status-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.status-name { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.status-fam {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  font-weight: 600;
}
.status-desc { margin: 4px 0 0; color: var(--text-dim); font-size: 0.92rem; }

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.status-chip {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  transition: all .15s;
  display: flex; flex-direction: column; gap: 2px;
}
.status-chip:hover { background: rgba(255,255,255,0.06); border-color: var(--line-strong); transform: translateY(-1px); }
.status-chip b {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  font-weight: 700;
}
.status-chip span { font-size: 0.78rem; color: var(--text-dim); }
.status-chip.fam-1 b { color: #9aa0c6; }
.status-chip.fam-2 b { color: #6fe89c; }
.status-chip.fam-3 b { color: #ffc977; }
.status-chip.fam-4 b { color: #ff8c8c; }
.status-chip.fam-5 b { color: #ff5ca8; }

.status-legend {
  display: flex; flex-wrap: wrap; gap: 18px;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.status-legend .dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.status-legend .dot--1 { background: #9aa0c6; }
.status-legend .dot--2 { background: #6fe89c; }
.status-legend .dot--3 { background: #ffc977; }
.status-legend .dot--4 { background: #ff8c8c; }
.status-legend .dot--5 { background: #ff5ca8; }

/* ---------- 18. Table ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  margin: 22px 0;
  font-size: 0.92rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.table thead { background: rgba(255,255,255,0.04); }
.table th, .table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
}
.table th { color: var(--text); font-weight: 600; font-size: 0.85rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255,255,255,0.025); }
.table--cmp .rest-col { color: var(--rest); }
.table--cmp .mcp-col  { color: var(--mcp); }

/* ---------- 19. Request builder ---------- */
.builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 24px 0;
}
.builder__form, .builder__preview { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-direction: column; gap: 6px; }
.row > label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  font-weight: 600;
}
.row input[type=text], .row input[type=number], .row textarea, .row select {
  background: #0a0b14;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  width: 100%;
  resize: vertical;
}
.row input:focus, .row textarea:focus, .row select:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.18);
}
.method-select { position: relative; }
.method-select select {
  appearance: none;
  font-weight: 700;
  padding-right: 36px;
}
.method-select::after {
  content: "▾";
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-mute);
  pointer-events: none;
}

.row .btn + .btn { margin-left: 8px; }
.row > .btn:not(:only-child) { display: inline-flex; }
.row:has(> .btn) { flex-direction: row; align-items: center; }

.preview {
  border-radius: var(--radius);
  background: #07080f;
  border: 1px solid var(--line);
  overflow: hidden;
}
.preview__head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.025);
  border-bottom: 1px solid var(--line);
}
.preview__title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  font-weight: 600;
}
.dot-row { display: flex; gap: 5px; }
.dot-row span {
  width: 11px; height: 11px; border-radius: 50%;
  background: #2a2c4a;
}
.dot-row span:nth-child(1) { background: #ff5f57; }
.dot-row span:nth-child(2) { background: #ffbd2e; }
.dot-row span:nth-child(3) { background: #28c840; }

.preview pre { border: 0; border-radius: 0; background: transparent; padding: 16px 18px; }

/* ---------- 20. Architecture diagram ---------- */
.arch-diagram {
  display: grid;
  grid-template-columns: 1fr 90px 1fr;
  gap: 18px;
  align-items: center;
  margin: 24px 0;
  padding: 24px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.arch-host {
  background: rgba(124,92,255,0.06);
  border: 1px solid rgba(124,92,255,0.3);
  border-radius: var(--radius);
  padding: 16px;
}
.arch-label { display: block; font-weight: 700; color: var(--text); font-size: 0.95rem; }
.arch-sub { display: block; font-size: 0.78rem; color: var(--text-mute); margin-top: 2px; }
.arch-clients { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.arch-client {
  background: rgba(0,212,255,0.06);
  border: 1px solid rgba(0,212,255,0.25);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.arch-servers { display: flex; flex-direction: column; gap: 10px; }
.arch-server {
  background: rgba(255,181,71,0.06);
  border: 1px solid rgba(255,181,71,0.3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.arch-wires svg { width: 100%; height: 120px; }

/* ---------- 21. Bullet list ---------- */
.bullet-list { list-style: none; padding: 0; margin: 16px 0; }
.bullet-list li {
  padding: 8px 0 8px 28px;
  position: relative;
  color: var(--text-dim);
}
.bullet-list li::before {
  content: "›";
  position: absolute; left: 6px; top: 6px;
  color: var(--accent-2);
  font-weight: 700;
  font-size: 1.1rem;
}

/* ---------- 22. MCP primitives ---------- */
.primitives {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0;
}
.prim {
  padding: 22px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
  position: relative;
  overflow: hidden;
  transition: transform .2s;
}
.prim:hover { transform: translateY(-3px); }
.prim::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
}
.prim--tools::before     { background: linear-gradient(90deg, #ffb547, #ff5ca8); }
.prim--resources::before { background: linear-gradient(90deg, #00d4ff, #7c5cff); }
.prim--prompts::before   { background: linear-gradient(90deg, #4ade80, #00d4ff); }
.prim__icon { font-size: 1.6rem; margin-bottom: 10px; }
.prim__who {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
  font-weight: 600;
}
.prim h3 { margin: 4px 0 6px; }
.prim p  { font-size: 0.92rem; }
.prim__ops { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.prim__ops code { font-size: 0.74rem; }
.sub-h { margin: 28px 0 8px; }

/* ---------- 23. JSON-RPC simulator ---------- */
.sim {
  margin: 24px 0;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  overflow: hidden;
}
.sim__rail {
  padding: 14px 16px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--line);
}
.sim__steps {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.sim__steps::-webkit-scrollbar { display: none; }
.sim__step {
  flex: 0 0 auto;
  padding: 6px 14px;
  font-size: 0.78rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all .15s;
  font-weight: 500;
  white-space: nowrap;
}
.sim__step:hover { color: var(--text); }
.sim__step.is-active {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}
.sim__step.is-done {
  border-color: rgba(74,222,128,0.4);
  color: var(--accent-ok);
}

.sim__stage { padding: 22px 24px 24px; }
.sim__cols {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}
.sim__col { display: flex; flex-direction: column; gap: 6px; }
.sim__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  font-weight: 700;
}
.sim__box {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: rgba(124,92,255,0.07);
  border: 1px solid rgba(124,92,255,0.3);
}
.sim__col--server .sim__box {
  background: rgba(255,181,71,0.07);
  border-color: rgba(255,181,71,0.3);
}
.sim__title { display: block; font-weight: 700; color: var(--text); }
.sim__sub   { display: block; font-size: 0.8rem; color: var(--text-mute); margin-top: 2px; }

.sim__wire { position: relative; height: 80px; }
.sim__wire svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sim__msg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
  transition: transform .4s cubic-bezier(.2,.8,.2,1), opacity .3s;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}
.sim__msg.dir-r { animation: flowRight 0.8s ease-out; }
.sim__msg.dir-l { animation: flowLeft  0.8s ease-out; }
@keyframes flowRight {
  0%   { transform: translate(-260%, -50%); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translate(160%, -50%); opacity: 0; }
}
@keyframes flowLeft {
  0%   { transform: translate(160%, -50%); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translate(-260%, -50%); opacity: 0; }
}

.sim__transcript {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #07080f;
  overflow: hidden;
}
.sim__transcript-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  background: rgba(255,255,255,0.025);
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.sim__counter { color: var(--accent-2); }
.sim__transcript pre { border: 0; border-radius: 0; background: transparent; }
.sim__note {
  margin: 0;
  padding: 12px 16px;
  background: rgba(124,92,255,0.06);
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 0.88rem;
}

.sim__controls {
  display: flex; gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ---------- 24. Playground ---------- */
.playground {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 18px;
  margin: 22px 0;
  align-items: start;
}
.playground__form { display: flex; flex-direction: column; gap: 12px; }
.playground__status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  margin-left: 14px;
}
.playground__status.ok  { color: var(--accent-ok); }
.playground__status.err { color: var(--accent-err); }
.playground__status.pending { color: var(--accent-2); }

/* ---------- 25. Quiz ---------- */
.quiz { margin: 22px 0; }
.quiz__progress {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.quiz__progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
}
.quiz__progress-bar > div {
  height: 100%;
  width: 0%;
  background: var(--gradient);
  transition: width .3s;
}
.quiz-q {
  margin: 14px 0;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
}
.quiz-q__num {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  font-weight: 700;
}
.quiz-q__text { margin: 6px 0 14px; font-weight: 600; color: var(--text); font-size: 1.05rem; }
.quiz-q__options { display: grid; gap: 8px; }
.quiz-opt {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all .15s;
  font-size: 0.95rem;
}
.quiz-opt:hover { border-color: var(--line-strong); background: rgba(255,255,255,0.06); }
.quiz-opt input { accent-color: var(--accent); }
.quiz-opt.is-chosen { border-color: var(--accent); background: rgba(124,92,255,0.08); }
.quiz-opt.is-correct { border-color: var(--accent-ok); background: rgba(74,222,128,0.08); }
.quiz-opt.is-wrong   { border-color: var(--accent-err); background: rgba(255,107,107,0.08); }
.quiz-q__explain {
  display: none;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(0,212,255,0.06);
  border-left: 3px solid var(--accent-2);
  font-size: 0.9rem;
  color: var(--text-dim);
}
.quiz-q.is-graded .quiz-q__explain { display: block; }

.quiz__result {
  margin-top: 24px;
  padding: 24px 26px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-strong);
}
.quiz__result h3 { margin-top: 0; }
.quiz__result.is-pass { border-left: 4px solid var(--accent-ok); background: rgba(74,222,128,0.05); }
.quiz__result.is-fail { border-left: 4px solid var(--accent-warn); }
.quiz__result-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.2rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- 26. Link list ---------- */
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.link-list li:last-child { border-bottom: 0; }

/* ---------- 27. End mark ---------- */
.endmark {
  margin-top: 40px;
  padding: 28px 32px;
  border-radius: var(--radius);
  background: var(--gradient);
  color: #fff;
  text-align: center;
}
.endmark p { color: rgba(255,255,255,0.95); margin: 0; font-size: 1.05rem; font-weight: 500; }
.endmark p + p { margin-top: 6px; opacity: 0.85; font-size: 0.85rem; font-weight: 400; }
.endmark .muted { color: rgba(255,255,255,0.7); }

/* ---------- 28. Toast ---------- */
.toast {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translate(-50%, 30px);
  background: #14152a;
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  z-index: 100;
  transition: opacity .25s, transform .3s;
  pointer-events: none;
  box-shadow: var(--shadow-2);
}
.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 29. Responsive ---------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    display: none;
  }
  .content { padding: 40px 24px 80px; max-width: 100%; }
  .topnav { display: none; }
}
@media (max-width: 720px) {
  .cards--2, .cards--3, .primitives, .defs, .defs--3 { grid-template-columns: 1fr; }
  .hero__stats { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .builder, .playground { grid-template-columns: 1fr; }
  .arch-diagram { grid-template-columns: 1fr; }
  .arch-wires { display: none; }
  .sim__cols { grid-template-columns: 1fr; }
  .sim__wire { height: 40px; }
  .topbar__inner { grid-template-columns: 1fr auto; gap: 12px; }
  .topbar__meta .btn--sm { display: none; }
  .progress { width: 80px; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  .content { padding: 24px 18px 80px; }
  .status-tool__search { grid-template-columns: 1fr; }
  .table { font-size: 0.82rem; }
  .table th, .table td { padding: 8px; }
}
