/* Created by Dukes — Dukes App documentation */

:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --text: #1c1c1a;
  --text-secondary: #5c5c57;
  --text-muted: #666661;
  --border: #e2e2dc;
  --border-strong: #cfcfc8;
  --accent: #0b63ce;
  --accent-hover: #084ea3;
  --accent-soft: rgba(11, 99, 206, 0.08);
  --warning: #9a6700;
  --warning-bg: rgba(154, 103, 0, 0.1);
  --danger: #b42318;
  --danger-bg: rgba(180, 35, 24, 0.08);
  --success: #17663a;
  --success-bg: rgba(23, 102, 58, 0.1);
  --info: #0b63ce;
  --info-bg: rgba(11, 99, 206, 0.08);
  --shadow: 0 1px 2px rgba(28, 28, 26, 0.06);
  --shadow-lg: 0 12px 32px rgba(28, 28, 26, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --header-h: 52px;
  --sidebar-w: 260px;
  --toc-w: 200px;
  --prose: 46rem;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --focus: 0 0 0 3px rgba(11, 99, 206, 0.35);
  --header-bg: #f4f4f2;
  --overlay: rgba(28, 28, 26, 0.45);
  --mark-bg: rgba(11, 99, 206, 0.16);
  --risk-low: #17663a;
  --risk-mod: #9a6700;
  --risk-high: #c2410c;
  --risk-crit: #b42318;
  --ka: #c2410c;
  --k: #0b63ce;
  --x: #6b7280;
}

html[data-theme="dark"] {
  --bg: #161618;
  --surface: #1e1e21;
  --surface-elevated: #26262a;
  --text: #f2f2ef;
  --text-secondary: #b0b0a8;
  --text-muted: #a0a099;
  --border: #2e2e33;
  --border-strong: #3d3d44;
  --accent: #4c9fff;
  --accent-hover: #7ab6ff;
  --accent-soft: rgba(76, 159, 255, 0.12);
  --warning: #e3b341;
  --warning-bg: rgba(227, 179, 65, 0.12);
  --danger: #f97066;
  --danger-bg: rgba(249, 112, 102, 0.12);
  --success: #3dd68c;
  --success-bg: rgba(61, 214, 140, 0.12);
  --info: #4c9fff;
  --info-bg: rgba(76, 159, 255, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
  --header-bg: #161618;
  --overlay: rgba(0, 0, 0, 0.6);
  --mark-bg: rgba(76, 159, 255, 0.22);
  --focus: 0 0 0 3px rgba(76, 159, 255, 0.4);
  --risk-low: #3dd68c;
  --risk-mod: #e3b341;
  --risk-high: #fb923c;
  --risk-crit: #f97066;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 400;
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.skip-link:focus {
  top: 8px;
  color: #fff;
}

/* ── Header ── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 120;
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space-5);
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.nav-brand:hover { color: var(--text); text-decoration: none; }
.nav-brand img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.header-nav {
  display: flex;
  gap: 4px;
  list-style: none;
  margin-left: var(--space-2);
}
.header-nav a {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.header-nav a:hover {
  color: var(--text);
  background: var(--accent-soft);
  text-decoration: none;
}
.header-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn,
.search-trigger,
.theme-toggle,
.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.search-trigger {
  min-width: 220px;
  justify-content: flex-start;
  color: var(--text-muted);
}
.search-trigger .kbd {
  margin-left: auto;
}
.search-trigger:hover,
.icon-btn:hover,
.theme-toggle:hover,
.sidebar-toggle:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.sidebar-toggle { display: none; }

.nav-menu-btn {
  display: none;
}

/* ── Search dialog ── */

.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--overlay);
}
.search-overlay.active { display: block; }

.search-modal {
  display: none;
  position: fixed;
  top: 12vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(100vw - 24px));
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 201;
}
.search-modal.active { display: flex; flex-direction: column; }

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.search-modal-header svg { color: var(--text-muted); flex-shrink: 0; }
.search-modal-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
  box-shadow: none;
}
.search-results {
  overflow-y: auto;
  max-height: calc(70vh - 56px);
  padding: 8px;
}
.search-result-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
}
.search-result-item:hover,
.search-result-item.is-active {
  background: var(--accent-soft);
  text-decoration: none;
}
.search-result-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.search-result-name mark {
  background: var(--mark-bg);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
.search-result-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.search-result-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.search-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Docs shell ── */

.docs-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-16);
  gap: var(--space-8);
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  max-height: calc(100vh - var(--header-h) - 24px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.docs-column {
  min-width: 0;
  max-width: 56rem;
}

.docs-column.wide {
  max-width: 64rem;
}

.page-toc {
  display: none;
  position: sticky;
  top: calc(var(--header-h) + 12px);
  max-height: calc(100vh - var(--header-h) - 24px);
  overflow-y: auto;
  padding-left: 4px;
}
.page-toc h2 {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.page-toc ul { list-style: none; }
.page-toc a {
  display: block;
  padding: 4px 0 4px 10px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  text-decoration: none;
}
.page-toc a:hover { color: var(--text); text-decoration: none; }
.page-toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

@media (min-width: 1280px) {
  .docs-shell {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  }
  .page-toc { display: block; }
}

/* ── Sidebar ── */

.pages-nav {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-group { margin-bottom: 6px; }
.sidebar-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--radius-sm);
  text-align: left;
}
.sidebar-group-toggle:hover { color: var(--text); background: var(--accent-soft); }
.sidebar-group-toggle svg {
  width: 12px;
  height: 12px;
  transition: transform 0.15s ease;
}
.sidebar-group.is-collapsed .sidebar-group-toggle svg { transform: rotate(-90deg); }
.sidebar-group.is-collapsed .sidebar-group-items { display: none; }
.sidebar-group-items { list-style: none; padding: 0 0 6px; }
.sidebar-group-items a {
  display: block;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  min-height: 32px;
}
.sidebar-group-items a:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}
.sidebar-group-items a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.sidebar-group-items a.child { padding-left: 18px; font-size: 12px; }

/* ── Hero / page intro ── */

.docs-hero {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
}
.docs-hero .kicker {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.docs-hero h1 {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 8px;
}
.docs-hero .lede {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 40rem;
  line-height: 1.5;
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hero-search {
  margin-top: 20px;
}
.hero-search .search-trigger {
  width: min(420px, 100%);
  min-height: 44px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}
.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { color: var(--border-strong); }

/* ── Quick cards ── */

.quick-grid,
.topic-grid,
.compare-grid,
.hud-grid,
.hw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0 8px;
}

.quick-card,
.topic-card,
.compare-card,
.hud-card,
.hw-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.quick-card:hover,
.topic-card:hover {
  border-color: var(--accent);
  background: var(--surface-elevated);
  text-decoration: none;
  color: inherit;
}
.quick-card .card-icon,
.hw-card .card-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
}
.quick-card h3,
.topic-card h3,
.topic-card h4,
.compare-card h3,
.hud-card h3,
.hw-card h3 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.quick-card p,
.topic-card p,
.compare-card p,
.hud-card p,
.hw-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.card-arrow {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
}
.hw-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.hw-tags span {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}

.compare-card .eyebrow {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hud-card.is-default { border-color: var(--accent); }

/* ── Sections ── */

.section {
  margin-top: var(--space-16);
}
.section-header {
  margin-bottom: var(--space-6);
  max-width: var(--prose);
}
.section-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--accent);
}
.section-kicker svg { width: 18px; height: 18px; }
.section-header h2 {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 8px;
}
.section-header p,
.guide-intro {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: var(--prose);
}
.guide-group {
  margin-top: var(--space-10);
  max-width: var(--prose);
}
.guide-group.wide,
.guide-wide {
  max-width: none;
}
.guide-group h3 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.guide-group h4 {
  font-size: 15px;
  font-weight: 650;
  margin: 16px 0 6px;
}
.guide-note {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 12px;
}

.docs-prose p,
.feature-detail p,
.step-content p {
  margin-bottom: 10px;
}
.docs-prose p:last-child,
.feature-detail p:last-child {
  margin-bottom: 0;
}

.feature-detail {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: var(--prose);
}
.feature-detail strong { color: var(--text); font-weight: 600; }

/* ── Badges ── */

.flag-row,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 4px;
}
.flag-badge,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
}
.flag-badge.experimental,
.badge.experimental {
  background: var(--warning-bg);
  border-color: transparent;
  color: var(--warning);
}
.flag-badge.off,
.badge.off {
  color: var(--text-muted);
}
.flag-badge.on,
.badge.on {
  background: var(--success-bg);
  border-color: transparent;
  color: var(--success);
}
.flag-badge.carplay,
.badge.carplay,
.flag-badge.phone,
.badge.phone {
  background: var(--info-bg);
  border-color: transparent;
  color: var(--info);
}
.flag-badge.detector,
.badge.hardware {
  color: var(--text-secondary);
}
.flag-badge.latest,
.badge.latest {
  background: var(--success-bg);
  border-color: transparent;
  color: var(--success);
}

/* ── Settings path ── */

.settings-path {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 8px 0 12px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.settings-path .sep {
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Callouts ── */

.callout {
  display: block;
  width: 100%;
  max-width: var(--prose);
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}
.callout-body { min-width: 0; }
.callout-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.callout p:not(.callout-label) {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.callout-info {
  border-left: 3px solid var(--info);
  background: var(--info-bg);
}
.callout-info .callout-label { color: var(--info); }
.callout-tip {
  border-left: 3px solid var(--success);
  background: var(--success-bg);
}
.callout-tip .callout-label { color: var(--success); }
.callout-important {
  border-left: 3px solid var(--warning);
  background: var(--warning-bg);
}
.callout-important .callout-label { color: var(--warning); }
.callout-experimental {
  border-left: 3px solid var(--warning);
  background: var(--warning-bg);
}
.callout-experimental .callout-label { color: var(--warning); }
.callout-compat {
  border-left: 3px solid var(--text-muted);
}
.callout-compat .callout-label { color: var(--text-muted); }

/* ── Tables ── */

.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.mode-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 480px;
}
.mode-table th,
.mode-table td {
  text-align: left;
  padding: 12px 14px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.mode-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 650;
  background: var(--bg);
}
.mode-table tbody tr:last-child td { border-bottom: 0; }
.mode-table td { color: var(--text-secondary); }
.mode-table td:first-child {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

/* ── Steps / alerts / CarPlay ── */

.steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.step-number {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 650;
}
.step-content h3 {
  font-size: 16px;
  font-weight: 650;
  margin-bottom: 4px;
}
.step-content p {
  font-size: 15px;
  color: var(--text-secondary);
}

.alert-gallery,
.cp-banner-gallery,
.cp-button-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: none;
}
.alert-card,
.cp-banner-card,
.cp-btn-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.alert-card img { max-width: 240px; border-radius: var(--radius-sm); }
.alert-info h4 { font-size: 15px; font-weight: 650; margin-bottom: 4px; }
.alert-info p,
.cp-banner-card p,
.cp-btn-item p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.cp-btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.cp-btn-item { flex: 1; min-width: 200px; align-items: flex-start; }
.cp-btn-item img { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
.cp-banner-card img {
  flex-shrink: 0;
  max-width: 200px;
  max-height: 70px;
  border-radius: var(--radius-sm);
}
.cp-banner-card p strong { color: var(--text); }

.risk-levels {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
  max-width: 28rem;
}
.risk-level {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.risk-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.risk-level.low .risk-swatch { background: var(--risk-low); }
.risk-level.moderate .risk-swatch { background: var(--risk-mod); }
.risk-level.high .risk-swatch { background: var(--risk-high); }
.risk-level.critical .risk-swatch { background: var(--risk-crit); }
.risk-level strong { font-size: 14px; }
.risk-level span { font-size: 13px; color: var(--text-secondary); }

.risk-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 16px 0;
}
.risk-badge-item { text-align: center; }
.risk-badge-item img {
  width: 52px;
  height: auto;
  border-radius: 12px;
  margin-bottom: 6px;
}
.risk-badge-item p {
  font-size: 13px;
  color: var(--text-secondary);
}

.guide-details {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 16px;
}
.guide-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 0;
  list-style: none;
}
.guide-details summary::-webkit-details-marker { display: none; }
.guide-details summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid var(--accent);
  margin-right: 8px;
}
.guide-details[open] summary::before { transform: rotate(90deg); }
.guide-details .feature-detail { padding-bottom: 12px; }

/* ── Settings reference ── */

.settings-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 24px;
}
.settings-filters button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.settings-filters button:hover { color: var(--text); }
.settings-filters button.is-active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.category { margin-top: var(--space-12); }
.category-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.category-header h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; }
.setting-card {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.setting-card:last-child { border-bottom: 0; }
.setting-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.setting-name { font-size: 16px; font-weight: 650; }
.setting-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  max-width: var(--prose);
}
.setting-meta {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 4px 12px;
  margin-top: 10px;
  font-size: 13px;
}
.setting-meta dt { color: var(--text-muted); font-weight: 500; }
.setting-meta dd { color: var(--text-secondary); }
.setting-hidden { display: none; }

.mi-section { margin-bottom: var(--space-12); }
.mi-section h2 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.mi-blurb {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 16px;
  max-width: var(--prose);
}

.mi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.mi-card,
.mi-overlay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.mi-card .mi-img-wrap {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.mi-card img { max-width: 56px; max-height: 56px; object-fit: contain; }
.mi-card h3, .mi-overlay-card h3 { font-size: 14px; font-weight: 650; margin-bottom: 4px; }
.mi-card p, .mi-overlay-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.mi-cat {
  display: inline-block;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ── Version history ── */

.vh-timeline { max-width: 44rem; }
.vh-version {
  position: relative;
  padding: 0 0 var(--space-10) 20px;
  border-left: 2px solid var(--border);
}
.vh-version:last-child { padding-bottom: 0; }
.vh-version::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.vh-version-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.vh-version-number {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.vh-date { font-size: 13px; color: var(--text-muted); }
.vh-version-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.vh-version-tag.latest {
  background: var(--success-bg);
  border-color: transparent;
  color: var(--success);
}
.vh-version-tag.current-source {
  background: var(--info-bg);
  border-color: transparent;
  color: var(--info);
}
.vh-version-summary {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.vh-list { list-style: none; }
.vh-list li {
  position: relative;
  padding: 4px 0 4px 16px;
  font-size: 14px;
  color: var(--text-secondary);
}
.vh-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
}
.vh-section-title {
  font-size: 13px;
  font-weight: 650;
  margin: 12px 0 6px;
}
.vh-toc {
  margin-bottom: var(--space-8);
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.vh-toc-title {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.vh-toc-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

/* ── Footer ── */

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-8) var(--space-5) var(--space-10);
  color: var(--text-muted);
  font-size: 13px;
}
.site-footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
}
.site-footer a { color: var(--text-secondary); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 12px 16px; }

.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.back-to-top.visible { display: flex; }

.screenshot-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.screenshot-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 90;
}
.sidebar-backdrop.active { display: block; }

/* ── Responsive ── */

@media (min-width: 1080px) {
  .pages-nav { display: none; }
}

@media (max-width: 1079px) {
  .docs-shell {
    grid-template-columns: minmax(0, 1fr);
    padding-top: var(--space-5);
  }
  .docs-column,
  .docs-column.wide {
    max-width: 56rem;
    margin-inline: auto;
  }
  .docs-sidebar {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    max-height: none;
    z-index: 100;
    background: var(--bg);
    border-right: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
  }
  .docs-sidebar.open { display: block; }
  .sidebar-toggle { display: inline-flex; }
  .page-toc { display: none !important; }
  .search-trigger .search-label,
  .search-trigger .kbd { display: none; }
  .search-trigger { min-width: 44px; padding: 0; }
}

@media (max-width: 768px) {
  .header-nav { display: none; }
  .nav-menu-btn { display: inline-flex; }
  .header-nav.mobile-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px;
    z-index: 110;
  }
  .header-nav.mobile-open a { min-height: 44px; }
  .mi-grid { grid-template-columns: repeat(2, 1fr); }
  .mode-table td:first-child { white-space: normal; }
  .alert-card,
  .cp-banner-card { flex-direction: column; align-items: stretch; }
  .alert-card img,
  .cp-banner-card img { max-width: 100%; max-height: none; }
  .cp-btn-row { flex-direction: column; }
  .cp-btn-item { min-width: 0; }
}

@media (max-width: 480px) {
  .mi-grid { grid-template-columns: 1fr 1fr; }
  .quick-grid,
  .topic-grid,
  .compare-grid,
  .hud-grid,
  .hw-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .mi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media print {
  .site-header, .docs-sidebar, .page-toc, .back-to-top, .search-trigger, .theme-toggle { display: none !important; }
  .docs-shell { display: block; }
}

/* Legacy aliases used by existing markup */
.nav { display: none; }
.content { display: contents; }
.main-content { min-width: 0; }
.footer { display: none; }
.hero { display: none; }
.inline-path { font-size: 13px; color: var(--text-muted); }
.settings-jump { color: var(--accent); font-weight: 500; }
.setting-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.setting-default { font-size: 12px; color: var(--text-muted); }
.setting-options { margin-top: 8px; font-size: 13px; color: var(--text-secondary); }
.setting-badge { display: none; }
.category-icon { display: none; }
.vh-divider { display: none; }
.mi-back, .vh-back { display: none; }
.docs-index h2 {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 28px 0 10px;
}
.docs-index h2:first-child { margin-top: 0; }

/* ── 404 ── */
.page-404 .not-found-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - var(--header-h));
  padding: 48px 24px;
  text-align: center;
}
.page-404 .not-found-main .eyebrow {
  font-size: 4rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.page-404 .not-found-main h1 {
  font-size: 1.5rem;
  margin-bottom: 10px;
}
.page-404 .not-found-main .lead {
  color: var(--text-secondary);
  max-width: 28rem;
  margin-bottom: 24px;
}
.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.not-found-actions a {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.not-found-actions .btn-primary {
  background: var(--accent);
  color: #fff;
}
.not-found-actions .btn-secondary {
  border: 1px solid var(--border);
  color: var(--text-primary);
  background: var(--surface);
}

.search-close{border:1px solid var(--border-strong);border-radius:6px;background:var(--surface);color:var(--text);padding:8px 12px;min-height:40px;font:inherit;cursor:pointer}
.search-close:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
