/* ============================================================
   MINECRAFT 1.8.9 PACKET REFERENCE — STYLESHEET
   Dark theme inspired by OpenAI API Reference
   ============================================================ */

/* --- RESET & VARIABLES --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #191919;
  --bg-hover: #1f1f1f;
  --bg-active: #262626;
  --border: #262626;
  --border-subtle: #1f1f1f;

  --text-primary: #ededed;
  --text-secondary: #a1a1a1;
  --text-muted: #a3a3a3;

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-dim: rgba(59, 130, 246, 0.12);

  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.12);
  --orange: #f97316;
  --orange-dim: rgba(249, 115, 22, 0.12);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --purple: #a855f7;
  --purple-dim: rgba(168, 85, 247, 0.12);
  --yellow: #eab308;
  --yellow-dim: rgba(234, 179, 8, 0.12);

  --sidebar-w: 280px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --radius: 8px;
  --radius-sm: 6px;
}

html { font-size: 15px; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-tertiary);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--text-secondary);
}

/* --- SIDEBAR --- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.2s ease;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.logo:hover { color: var(--accent); }
.logo strong { color: var(--accent); }

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

.sidebar-search {
  position: relative;
  padding: 12px 12px 10px;
  display: flex;
  align-items: center;
}

.sidebar-search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.sidebar-search input {
  width: 100%;
  height: 34px;
  line-height: 34px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px 0 32px;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}
.sidebar-search input:focus { border-color: var(--accent); }
.sidebar-search input::placeholder { color: var(--text-muted); }

.search-kbd {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.65rem;
  font-family: var(--font-sans);
  color: var(--text-muted);
  pointer-events: none;
}

/* --- FILTER BAR --- */
.sidebar-filter-bar {
  position: relative;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.filter-btn.has-filters { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

.filter-count {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
}

.filter-dropdown {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 100%;
  margin-top: 2px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  max-height: 420px;
  overflow-y: auto;
}

.filter-section { margin-bottom: 10px; }
.filter-section:last-child { margin-bottom: 0; }

.filter-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.filter-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.1s;
}
.filter-opt:hover { background: var(--bg-hover); }
.filter-opt input[type="radio"] { accent-color: var(--accent); }

.filter-tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 150px;
  overflow-y: auto;
}

.filter-tag-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
}
.filter-tag-chip:hover { border-color: var(--text-muted); }
.filter-tag-chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.filter-clear {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 4px 0;
  background: none;
  border: none;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  font-family: var(--font-sans);
  color: var(--red);
  cursor: pointer;
  text-align: center;
}
.filter-clear:hover { color: #f87171; }

/* --- OVERVIEW INTRO (homepage education) --- */
.overview-intro {
  margin-top: 40px;
}
.overview-intro h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 28px 0 10px;
  color: var(--text-primary);
}
.overview-intro h2:first-child { margin-top: 0; }
.overview-intro p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
}
.overview-intro ul {
  margin: 0 0 16px 20px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.overview-intro li { margin-bottom: 6px; }
.overview-intro strong { color: var(--text-primary); }
.overview-intro code { font-size: 0.82em; color: var(--accent); }

.state-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0 24px;
}
@media (max-width: 600px) { .state-cards { grid-template-columns: 1fr; } }

.state-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.state-card h4,
.state-card h2 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}
.state-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* --- IMPLEMENTATION SECTION IN DETAIL --- */
.impl-section {
  border-top: 1px solid var(--orange-dim);
  padding: 20px 0;
  margin-top: 4px;
}
.impl-section h2 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--orange);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.impl-badge {
  font-size: 0.6rem;
  background: var(--orange-dim);
  color: var(--orange);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}
.impl-badge.ac {
  background: var(--red-dim);
  color: var(--red);
}
.ac-section { border-top-color: var(--red-dim); }
.ac-section h2 { color: var(--red); }
.impl-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.impl-module-tag {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1px 7px;
  color: var(--orange);
}
.impl-pattern {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
}
.impl-code {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  margin-bottom: 8px;
}
.impl-code code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: none;
  padding: 0;
  white-space: pre;
  line-height: 1.55;
}
.impl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.impl-meta span { display: flex; align-items: center; gap: 4px; }
.impl-meta strong { color: var(--text-secondary); }
.impl-clients {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
  white-space: pre-wrap;
}

.impl-module-entry {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.impl-module-entry:last-child { margin-bottom: 0; }

.impl-module-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.impl-module-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--orange);
  font-family: var(--font-mono);
}
.impl-module-clients {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.impl-code-wrap {
  position: relative;
  margin-bottom: 8px;
}
.impl-code-wrap.collapsed .impl-code {
  max-height: 110px;
  overflow: hidden;
}
.impl-code-wrap.expanded .impl-code { max-height: none; }
.impl-code-wrap.expanded .code-expand-btn .expand-icon-collapsed { display: none; }
.impl-code-wrap.collapsed .code-expand-btn .expand-icon-expanded { display: none; }

.impl-code {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 12px 14px;
  overflow-x: auto;
  margin-bottom: 0;
}
.impl-code code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: none;
  padding: 0;
  white-space: pre;
  line-height: 1.55;
}

.code-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 4px 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  cursor: pointer;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
  transition: color 0.1s, background 0.1s;
}
.code-expand-btn:hover { color: var(--accent); background: var(--bg-hover); }

/* --- SIDEBAR NAV --- */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-section { margin-bottom: 4px; }

.nav-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: color 0.12s;
}
.nav-section-header:hover { color: var(--text-secondary); }

.nav-section-header .chevron {
  transition: transform 0.15s;
  flex-shrink: 0;
}
.nav-section-header.collapsed .chevron { transform: rotate(-90deg); }

.nav-section-header .count {
  margin-left: auto;
  font-weight: 400;
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 0 5px;
  border-radius: 8px;
}

.nav-items { overflow: hidden; }
.nav-items.collapsed { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px 5px 28px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.1s;
  border-left: 2px solid transparent;
  text-decoration: none;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

.nav-item .nav-hex {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  min-width: 28px;
}
.nav-item .nav-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item .nav-dir {
  font-size: 0.6rem;
  padding: 1px 4px;
  border-radius: 3px;
  flex-shrink: 0;
}
.nav-dir.sb { background: var(--green-dim); color: var(--green); }
.nav-dir.cb { background: var(--purple-dim); color: var(--purple); }

/* --- MAIN CONTENT --- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-overview, .content-detail {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 48px 80px;
  width: 100%;
}

/* --- OVERVIEW --- */
.content-header h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.6;
}
.subtitle strong { color: var(--text-primary); }

.overview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 40px 0;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.stat-card .stat-num {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.overview-sections { margin-top: 8px; }

.overview-section {
  border-top: 1px solid var(--border-subtle);
  padding: 28px 0;
}
.overview-section h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.overview-section .section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.section-packet-list {
  display: grid;
  gap: 6px;
}

.section-packet-row {
  display: grid;
  grid-template-columns: 38px minmax(120px, 1fr) 2fr auto;
  align-items: start;
  gap: 8px 10px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s;
  text-decoration: none;
  color: var(--text-primary);
}
.section-packet-row:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  text-decoration: none;
}
.section-packet-row .row-hex {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-top: 1px;
}
.section-packet-row .row-name {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.35;
}
.section-packet-row .row-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.section-packet-row .row-modules {
  font-size: 0.66rem;
  color: var(--orange);
  background: var(--orange-dim);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
  align-self: center;
}
.section-packet-row .row-dir {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.overview-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* --- PACKET DETAIL --- */
.detail-header {
  margin-bottom: 32px;
}
.detail-header .detail-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 16px;
  transition: color 0.12s;
  background: none;
  border: none;
  font-family: var(--font-sans);
}
.detail-back:hover { color: var(--text-primary); }

.detail-permalink {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
  transition: color 0.12s;
  text-decoration: none;
}
.detail-permalink:hover { color: var(--accent); text-decoration: none; }

.detail-header h2,
.detail-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.detail-header h2 .detail-hex,
.detail-header h1 .detail-hex {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 400;
}
.detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.detail-meta .badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.detail-meta .badge.dir-sb { background: var(--green-dim); color: var(--green); }
.detail-meta .badge.dir-cb { background: var(--purple-dim); color: var(--purple); }
.detail-meta .badge.state { background: var(--yellow-dim); color: var(--yellow); }
.detail-meta .meta-sep { color: var(--border); }
.detail-meta .meta-mcp {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.detail-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 8px;
}

.detail-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.detail-tags .dtag {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 8px;
  color: var(--text-muted);
}

/* --- DETAIL SECTIONS --- */
.detail-section {
  border-top: 1px solid var(--border-subtle);
  padding: 24px 0;
}
.detail-section h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

/* Fields table */
.fields-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.fields-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
}
.fields-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.fields-table tr:last-child td { border-bottom: none; }
.fields-table .f-name {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
}
.fields-table .f-type {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.fields-table .f-desc {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

/* Encoding table */
.encoding-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.encoding-table th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 14px;
  background: var(--bg-tertiary);
}
.encoding-table td {
  padding: 7px 14px;
  border-top: 1px solid var(--border-subtle);
}
.encoding-table .e-field {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-primary);
}
.encoding-table .e-type {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
}
.encoding-table .e-notes {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Subclasses */
.subclass-list { display: grid; gap: 6px; }
.subclass-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.subclass-item .sub-name {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
  flex-shrink: 0;
}
.subclass-item .sub-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* MCP reference */
.mcp-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.mcp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  margin-bottom: 6px;
}
.mcp-row:last-child { margin-bottom: 0; }
.mcp-row .mcp-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  min-width: 28px;
}
.mcp-row code {
  background: none;
  padding: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Notes */
.notes-box {
  background: var(--accent-dim);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- NO RESULTS --- */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.no-results h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 6px; }

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    z-index: 1100;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1050;
    width: 34px;
    height: 34px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
  }
  .sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

  .content-overview, .content-detail { padding: 24px 16px 60px; }

  .overview-stats { grid-template-columns: 1fr; }
  .section-packet-row { grid-template-columns: 38px 1fr auto; }
  .section-packet-row .row-desc { display: none; }
}

@media (max-width: 600px) {
  .content-header h1 { font-size: 1.5rem; }
  .detail-header h2, .detail-header h1 { font-size: 1.2rem; }
}

/* --- DEEP DIVE WRITEUP + CALLOUTS --- */
.writeup-block {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.writeup-block h3 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 18px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.writeup-block h3:first-child { margin-top: 0; }
.writeup-block p { margin-bottom: 10px; }
.writeup-block code {
  font-size: 0.82em;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--green);
}
.writeup-code {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  margin: 10px 0;
}
.writeup-code code {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
  line-height: 1.55;
}
.writeup-list { margin: 6px 0 12px 18px; }
.writeup-list li { margin-bottom: 4px; }

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  padding: 12px 16px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.65;
}
.callout p { margin-bottom: 8px; }
.callout p:last-child { margin-bottom: 0; }
.callout code {
  font-size: 0.82em;
  background: var(--bg-tertiary);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--accent);
}
.callout-server { border-left-color: var(--accent); }
.callout-server code { color: var(--accent); }
.callout-proto { border-left-color: var(--purple); }
.callout-proto code { color: var(--purple); }
.callout-ac { border-left-color: var(--red); }
.callout-ac code { color: var(--red); }

/* --- RELATED PACKETS --- */
.related-list { display: flex; flex-wrap: wrap; gap: 8px; }
.related-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  color: var(--text-secondary);
  transition: border-color 0.15s, color 0.15s;
}
.related-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* --- MODULE INDEX PAGE --- */
.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 8px;
}
.mod-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.mod-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.mod-card-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}
.mod-card-count {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}
.mod-card-pkts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.mod-card-clients {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- CODE VIEWER (shared: packet pages + analysis pages) --- */
.code-viewer { border:1px solid var(--border); border-radius:var(--radius-sm); overflow:hidden; margin:12px 0; background:#0d1117; }
.cv-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:12px; padding:8px 14px; background:#161b22; border-bottom:1px solid var(--border); font-size:0.78rem; }
.cv-file { font-family:var(--font-mono); color:var(--text-primary); font-weight:600; }
.cv-meta { color:var(--text-muted); flex:1 1 auto; min-width:200px; }
.cv-copy { margin-left:auto; background:var(--bg-tertiary); border:1px solid var(--border); color:var(--text-secondary); font-size:0.7rem; padding:3px 10px; border-radius:4px; cursor:pointer; }
.cv-copy:hover { border-color:var(--accent); color:var(--accent); }
.cv-link { color:var(--accent); text-decoration:none; font-size:0.72rem; }
.cv-body { max-height:640px; overflow:auto; }
.cv-table { width:100%; border-collapse:collapse; font-family:var(--font-mono); font-size:0.76rem; line-height:1.55; }
.cv-table .cv-ln { width:48px; text-align:right; padding:0 10px 0 0; color:#484f58; background:#0d1117; border-right:1px solid #21262d; user-select:none; white-space:nowrap; vertical-align:top; }
.cv-table .cv-num { display:inline-block; width:28px; text-align:right; }
.cv-table .cv-code { padding:0 14px; vertical-align:top; }
.cv-table .cv-code pre { margin:0; background:transparent; }
.cv-table .cv-code code { background:transparent; padding:0; font-size:inherit; color:var(--text-primary); }
.cv-table .cv-code .hljs { background:transparent; padding:0; }

/* --- MODULE SOURCE DISCLOSURES (26.x module pages) --- */
.mod-src { border:1px solid var(--border); border-radius:var(--radius-sm); margin:12px 0; background:var(--bg-secondary); overflow:hidden; }
.mod-src > summary { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 12px; padding:11px 16px 11px 36px; cursor:pointer; position:relative; font-size:0.82rem; list-style:none; }
.mod-src > summary::-webkit-details-marker { display:none; }
.mod-src > summary::before { content:''; position:absolute; left:16px; top:15px; width:6px; height:6px; border-right:2px solid var(--text-muted); border-bottom:2px solid var(--text-muted); transform:rotate(-45deg); transition:transform 0.15s ease; }
.mod-src[open] > summary::before { transform:rotate(45deg); border-color:var(--accent); }
.mod-src > summary:hover { background:var(--bg-tertiary); }
.mod-src[open] > summary { border-bottom:1px solid var(--border); }
.mod-src .mod-src-client { font-weight:600; color:var(--text-primary); }
.mod-src .mod-src-cat { font-size:0.66rem; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-muted); border:1px solid var(--border); border-radius:4px; padding:1px 7px; }
.mod-src .mod-src-file { font-family:var(--font-mono); font-size:0.72rem; color:var(--text-secondary); word-break:normal; overflow-wrap:anywhere; }
.mod-src .mod-src-meta { margin-left:auto; font-size:0.7rem; color:var(--text-muted); white-space:nowrap; }
.mod-src .mod-src-body { padding:0 14px 10px; }
.mod-src .mod-src-body .code-viewer { margin:10px 0 0; }
/* mined module description + settings, shown above the full source viewer */
.mod-src-info { padding:10px 14px 0; }
.mod-src-desc { font-size:0.8rem; color:var(--text-secondary); line-height:1.6; margin:0 0 8px; }
.mod-settings { display:flex; flex-wrap:wrap; gap:5px; margin:0 0 4px; }
.mod-settings code { font-size:0.68rem; color:var(--text-secondary); background:var(--bg-tertiary); border:1px solid var(--border); border-radius:4px; padding:1px 7px; }
.mod-settings .mod-settings-label { font-size:0.66rem; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-muted); margin-right:2px; align-self:center; }

/* --- RELATED UTILITIES + MIXINS (nested inside a client source block) --- */
.mod-related { margin-top:10px; }
.mod-related > summary { cursor:pointer; font-size:0.82rem; }
.mod-related .related-chip { font-size:0.68rem; padding:2px 9px; }
.mod-mixin { margin-top:10px; }
.mod-related .mod-mixin:first-child { margin-top:6px; }
.mod-mixin-head { display:flex; flex-wrap:wrap; align-items:baseline; gap:3px 10px; font-size:0.74rem; }
.mod-mixin-file { font-family:var(--font-mono); font-size:0.72rem; color:var(--text-secondary); overflow-wrap:anywhere; }
.mod-mixin-meta { font-size:0.7rem; color:var(--text-muted); }
.mod-mixin-ann { margin:4px 0 0; font-size:0.72rem; }
.mod-mixin-ann code { font-family:var(--font-mono); color:var(--text-secondary); background:var(--bg-tertiary); border:1px solid var(--border); border-radius:4px; padding:1px 7px; white-space:pre-wrap; overflow-wrap:anywhere; }
.mod-mixin-badge { font-size:0.66rem; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-muted); border:1px solid var(--border); border-radius:4px; padding:1px 7px; margin-left:6px; }
.mod-mixin-targets { display:flex; flex-wrap:wrap; align-items:center; gap:5px; margin-top:6px; }
.mod-mixin-targets .mod-mixin-label { font-size:0.66rem; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-muted); margin-right:2px; }

/* --- STATIC PACKET INDEX (home page, no-JS crawlability) --- */
/* prose links must be distinguishable beyond color */
p a,
.subtitle a,
.detail-desc a,
.overview-footer a {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.static-packet-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.static-packet-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 9px;
  transition: border-color 0.12s, color 0.12s;
}
.static-packet-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- PRINT --- */
@media print {
  .sidebar { display: none; }
  .main { margin: 0; }
  body { background: #fff; color: #000; }
}
