/* Vector 2022-inspired: 1000px pin, 720px compact. Dark default; html[data-theme]. */
    :root {
      --wiki-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
      --wiki-serif: "Linux Libertine", Georgia, "Times New Roman", serif;
      --header-h: 3.25rem;
      --col-head-h: 2.85rem;
    }
    html[data-theme="light"] {
      color-scheme: light;
      --bg: #f8f9fa;
      --paper: #ffffff;
      --text: #202122;
      --muted: #54595d;
      --link: #3366cc;
      --link-visited: #795cb2;
      --border: #a2a9b1;
      --ref-bg: #f8f9fa;
      --accent: #3366cc;
      --header-bg: #ffffff;
      --badge-bg: #eaecf0;
      --input-bg: #ffffff;
      --code-bg: #f8f9fa;
      --cite-color: #3366cc;
      --debug-bg: #ffffff;
      --debug-border: #eaecf0;
      --warn: #ac6600;
      --danger: #d73333;
      --redlink: #ba0000;
      --dev-chip: #b32424;
      --dev-chip-bg: #fee7e6;
      --graph-bg: #ffffff;
      --header-fg: #202122;
      --overlay: rgba(255,255,255,0.92);
      --user-bubble: #eaecf0;
    }
    html[data-theme="dark"] {
      color-scheme: dark;
      --bg: #101418;
      --paper: #101418;
      --text: #f8f9fa;
      --muted: #a2aaad;
      --link: #6dadd6;
      --link-visited: #c8a0d8;
      --border: #54595d;
      --ref-bg: #1d2226;
      --accent: #6dadd6;
      --header-bg: #101418;
      --badge-bg: #27292d;
      --input-bg: #1d2226;
      --code-bg: #27292d;
      --cite-color: #6dadd6;
      --debug-bg: #101418;
      --debug-border: #54595d;
      --warn: #fc3;
      --danger: #ff6b6b;
      --redlink: #ff6b6b;
      --dev-chip: #ffb3b3;
      --dev-chip-bg: #3d1515;
      --graph-bg: #101418;
      --header-fg: #f8f9fa;
      --overlay: rgba(16,20,24,0.92);
      --user-bubble: #27292d;
    }
    * { box-sizing: border-box; border-radius: 0; }
    html, body { max-width: 100%; }
    body {
      margin: 0;
      font-family: "Linux Libertine", Georgia, Times, "Source Serif Pro", serif;
      background: var(--bg);
      color: var(--text);
      line-height: 1.6;
      font-size: 1rem;
      overflow-x: hidden;
      -webkit-text-size-adjust: 100%;
    }
    a { color: var(--link); }
    a:visited { color: var(--link-visited); }
    /* Wikipedia-style internal links */
    a.wikilink {
      color: var(--link);
      text-decoration: none;
      border-bottom: 1px solid transparent;
    }
    a.wikilink:hover { border-bottom-color: var(--link); }
    a.wikilink:visited { color: var(--link-visited); }
    a.wikilink.new {
      color: var(--redlink);
      border-bottom: 1px dashed var(--redlink);
    }
    a.wikilink.new:visited { color: var(--redlink); }
    .page-list { list-style: none; margin: 0; padding: 0; }
    .page-list li { margin: 0.35rem 0; padding: 0.15rem 0; }
    .vector-column-start .page-list li {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.2rem 0.3rem;
    }
    .page-list li.active {
      background: rgba(56, 139, 253, 0.12);
      border-radius: 0;
      padding-left: 0.35rem;
      margin-left: -0.35rem;
    }
    .see-also { margin: 0.35rem 0 0; padding-left: 1.2rem; }
    .article .lead-meta a { font-family: system-ui, sans-serif; }
    .mw-jump-link {
      position: absolute; left: -9999px;
    }
    .mw-jump-link:focus { left: 0.5rem; top: 0.5rem; z-index: 60; background: var(--paper); padding: 0.3rem; }
    .vector-header {
      position: -webkit-sticky; position: sticky; top: 0; z-index: 40;
      display: flex; align-items: center; gap: 0.5rem;
      height: var(--header-h);
      padding: 0 0.85rem;
      background: var(--header-bg);
      border-bottom: 1px solid var(--border);
      font-family: var(--wiki-sans);
      font-size: 0.95rem;
      color: var(--header-fg);
    }
    .vector-logo {
      font-family: var(--wiki-serif);
      font-size: 1.35rem;
      color: var(--text) !important;
      text-decoration: none;
      white-space: nowrap;
    }
    .logo-aside {
      font-family: var(--wiki-sans);
      font-size: 0.68rem;
      font-weight: 500;
      letter-spacing: 0.01em;
      margin-left: 0.4rem;
      color: var(--muted);
      white-space: nowrap;
    }
    .vector-header-end {
      margin-left: auto;
      display: flex;
      align-items: center;
      gap: 0.4rem;
      flex-shrink: 0;
    }
    .vector-stats { display: none; font-size: 0.75rem; white-space: nowrap; }
    .vector-icon-btn {
      -webkit-appearance: none;
      appearance: none;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1px solid var(--border);
      background: var(--paper);
      color: var(--text);
      width: 2.1rem;
      height: 2.1rem;
      min-height: 2.1rem;
      cursor: pointer;
      font-size: 1.05rem;
      border-radius: 0;
      font-family: var(--wiki-sans);
      padding: 0;
      box-sizing: border-box;
      flex: 0 0 auto;
    }
    .vector-icon-btn.text-btn {
      width: auto;
      padding: 0 0.55rem;
      font-size: 0.8rem;
      font-weight: 600;
      white-space: nowrap;
      line-height: 1;
    }
    a.vector-icon-btn,
    a.vector-icon-btn:link,
    a.vector-icon-btn:visited {
      color: var(--text);
      text-decoration: none;
    }
    .header-account {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      flex-shrink: 0;
    }
    .header-account .vector-icon-btn,
    .header-account a.sidebar-link,
    .header-account a.sidebar-link:link,
    .header-account a.sidebar-link:visited {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: auto;
      height: 2.1rem;
      min-height: 2.1rem;
      margin: 0;
      padding: 0 0.55rem;
      border: 1px solid var(--border);
      background: var(--paper);
      color: var(--text) !important;
      text-decoration: none;
      text-transform: none;
      letter-spacing: 0;
      font-family: var(--wiki-sans);
      font-size: 0.8rem;
      font-weight: 600;
      line-height: 1;
      white-space: nowrap;
      cursor: pointer;
      box-sizing: border-box;
      -webkit-appearance: none;
      appearance: none;
      flex: 0 0 auto;
    }
    #btn-feedback {
      background: var(--dev-chip-bg);
      color: var(--dev-chip);
      border-color: var(--dev-chip);
    }
    #btn-main-menu, #btn-ask { display: none; }
    .dev-chip {
      font-family: var(--wiki-sans);
      font-size: 0.72rem;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      background: var(--dev-chip-bg);
      color: var(--dev-chip);
      border: 1px solid var(--dev-chip);
      border-radius: 0;
      padding: 0.35rem 0.55rem;
      cursor: pointer;
    }
    #menu-backdrop {
      position: fixed; inset: 0; background: rgba(0,0,0,0.25); z-index: 35;
    }
    #menu-backdrop[hidden] { display: none; }
    .mw-page-container { background: var(--bg); min-height: calc(100vh - var(--header-h)); }
    .mw-page-container-inner {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      grid-template-areas:
        "content-head"
        "content";
      column-gap: 1.5rem;
      row-gap: 0;
      max-width: 99rem;
      margin: 0 auto;
      padding: 0.75rem 0.85rem 2.5rem;
      align-items: stretch;
      min-width: 0;
    }
    #start-head { grid-area: start-head; }
    #content-head { grid-area: content-head; }
    #end-head { grid-area: end-head; }
    .vector-column-start { grid-area: start; min-width: 0; width: 100%; justify-self: stretch; align-self: start; font-size: 0.95rem; }
    .mw-body { grid-area: content; min-width: 0; width: 100%; max-width: none; justify-self: stretch; align-self: start; }
    .vector-column-end { grid-area: end; min-width: 0; width: 100%; justify-self: stretch; align-self: start; font-size: 0.95rem; }
    .col-first-head {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      gap: 0.5rem;
      min-height: var(--col-head-h);
      margin: 0;
      padding: 0 0 0.3rem;
      border-bottom: 1px solid var(--border);
      box-sizing: border-box;
    }
    .col-first-head h1,
    .col-first-head h2 {
      margin: 0;
      padding: 0;
      border: 0;
      min-width: 0;
    }
    .col-first-head h1 {
      font-family: var(--wiki-serif);
      font-size: 1.85rem;
      font-weight: 400;
      line-height: 1.25;
      overflow-wrap: anywhere;
    }
    body.menu-open, body.ask-open { overflow: hidden; }
    @media (min-width: 1000px) {
      body.menu-open, body.ask-open { overflow: auto; }
    }
    .chat-turn details.wiki-section {
      margin-top: 0.45rem;
      font-size: 0.8rem;
    }
    .chat-turn details.wiki-section > summary { font-size: 0.9rem; }
    .chat-turn .bubble details.wiki-section {
      margin-top: 0.55rem;
      border-top: 1px solid var(--border);
      padding-top: 0.25rem;
    }
    .chat-turn .dev-trace { margin-top: 0.4rem; }
    .chat-turn .plain { white-space: pre-wrap; }
    .col-first-head h2 {
      font-family: var(--wiki-sans);
      font-size: 0.78rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--text);
    }
    .drawer-head { display: none; flex-shrink: 0; }
    .vector-menu {
      font-family: var(--wiki-sans);
      font-size: 0.88rem;
      margin-bottom: 1.1rem;
    }
    .vector-column-start > .sidebar-fold:first-of-type {
      margin-top: 0.35rem;
    }
    .on-this-day {
      font-family: var(--wiki-sans);
      font-size: 0.82rem;
      margin: 1.1rem 0 0;
      padding-top: 0.75rem;
      border-top: 1px solid var(--border);
    }
    .on-this-day > h2 {
      margin: 0 0 0.4rem;
      font-size: 0.78rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--text);
      border-bottom: 1px solid var(--border);
      padding-bottom: 0.2rem;
    }
    .sample-mail { margin: 0.4rem 0 1rem; font-family: var(--wiki-sans); font-size: 0.92rem; }
    .sample-mail dt { float: left; clear: left; width: 3.2rem; color: var(--muted); }
    .sample-mail dd { margin: 0 0 0.2rem 3.4rem; }
    .sample-note { font-size: 0.85rem; }
    .on-this-day .otd-date {
      margin: 0.35rem 0 0.25rem;
      color: var(--muted);
      font-size: 0.78rem;
    }
    .on-this-day .otd-headline {
      margin: 0 0 0.25rem;
      font-family: var(--wiki-serif);
      font-size: 0.95rem;
      font-weight: 600;
      line-height: 1.3;
      color: var(--text);
    }
    .on-this-day .otd-blurb {
      margin: 0 0 0.35rem;
      line-height: 1.35;
      color: var(--text);
    }
    .on-this-day .otd-src {
      margin: 0;
      font-size: 0.75rem;
    }
    .vector-menu h2,
    .sidebar-fold > summary {
      margin: 0 0 0.4rem;
      font-size: 0.78rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--muted);
      border-bottom: 1px solid var(--border);
      padding-bottom: 0.2rem;
    }
    .sidebar-fold > summary {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.15rem 0.3rem;
      cursor: pointer;
      list-style: none;
      min-height: 1.5rem;
    }
    .sidebar-fold > summary::-webkit-details-marker { display: none; }
    .sidebar-fold > summary::before {
      content: "▶ ";
      font-size: 0.65rem;
      color: var(--muted);
    }
    .sidebar-fold[open] > summary::before { content: "▼ "; }
    .vector-column-start .entity-list { columns: 1; font-size: 0.8rem; padding-left: 1rem; }
    .vector-column-start .kind-block { margin: 0.35rem 0; }
    .fold-add {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 1.5rem;
      height: 1.5rem;
      padding: 0;
      margin-left: 0.35rem;
      border: 1px solid var(--accent);
      background: var(--accent);
      color: #fff;
      cursor: pointer;
      flex: 0 0 1.5rem;
      flex-shrink: 0;
      overflow: hidden;
    }
    .fold-add-icon {
      display: block;
      width: 10px;
      height: 10px;
      position: relative;
    }
    .fold-add-icon::before,
    .fold-add-icon::after {
      content: "";
      position: absolute;
      left: 50%;
      top: 50%;
      background: #fff;
      transform: translate(-50%, -50%);
    }
    .fold-add-icon::before { width: 10px; height: 2px; }
    .fold-add-icon::after { width: 2px; height: 10px; }
    .sidebar-fold > summary .fold-add { margin-left: auto; }
    .fold-add:hover { filter: brightness(1.08); }
    .sidebar-link,
    .sidebar-link:link,
    .sidebar-link:visited {
      display: block;
      font-family: var(--wiki-sans);
      font-size: 0.78rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--muted);
      text-decoration: none;
      border-bottom: 1px solid var(--border);
      padding-bottom: 0.2rem;
      margin-bottom: 1.1rem;
    }
    .sidebar-link:hover { color: var(--link); }
    .sidebar-account { display: none; }
    .sidebar-account .sidebar-btn {
      width: 100%;
      justify-content: center;
      height: auto;
      min-height: 1.7rem;
      margin: 0 0 1.1rem;
      padding: 0.35rem 0.55rem;
    }
    .sidebar-account .sidebar-btn.danger {
      color: var(--danger);
      border-color: var(--danger);
      background: transparent;
    }
    .stats-dl { margin: 0.35rem 0 0; font-size: 0.8rem; }
    .stats-dl dt {
      font-weight: 700;
      color: var(--muted);
      margin-top: 0.45rem;
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.03em;
    }
    .stats-dl dt:first-child { margin-top: 0; }
    .stats-dl dd { margin: 0.1rem 0 0; }
    .sug-list { list-style: none; margin: 0.35rem 0 0; padding: 0; }
    .sug-row {
      display: flex;
      align-items: center;
      gap: 0.2rem;
      margin: 0.3rem 0;
      min-width: 0;
    }
    .sug-row code {
      flex: 1 1 auto;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .sug-row .badge,
    .sug-row .ent-btn {
      flex: 0 0 auto;
      white-space: nowrap;
    }
    body[data-view="graph"] .mw-body {
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .graph-hint {
      flex: 0 0 auto;
      margin: 0 0 0.55rem;
      padding: 0.4rem 0.55rem;
      font-family: var(--wiki-sans);
      font-size: 0.85rem;
      color: var(--text);
      background: var(--ref-bg);
      border: 1px solid var(--border);
    }
    body[data-view="graph"] #wiki-body {
      flex: 1 1 0%;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }
    body[data-view="graph"] .wiki-graph {
      flex: 1 1 0%;
      min-height: 18rem;
      height: auto;
    }
    body[data-view="graph"] .site-footer { display: none; }
    body[data-view="category"] #see-also,
    body[data-view="category"] #references,
    body[data-view="graph"] #see-also,
    body[data-view="graph"] #references,
    body[data-view="graph"] #page-actions,
    body[data-view="graph"] #content > .lead-meta { display: none; }
    .graph-filters {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.35rem 0.75rem;
      font-family: var(--wiki-sans);
      font-size: 0.8rem;
      margin: 0.5rem 0 0.75rem;
    }
    .graph-filters-label {
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--muted);
      font-size: 0.72rem;
    }
    .graph-filters label {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      cursor: pointer;
    }
    .graph-kind-swatch {
      display: inline-block;
      width: 0.7rem;
      height: 0.7rem;
      border-radius: 50%;
      flex: 0 0 auto;
      box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
    }
    html[data-theme="dark"] .graph-kind-swatch {
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
    }
    .graph-when input[type="date"] {
      font: inherit;
      color: var(--text);
      background: var(--input-bg);
      border: 1px solid var(--border);
      min-height: 1.7rem;
      padding: 0.1rem 0.35rem;
      max-width: 11rem;
    }
    .graph-when button.active {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
      font-weight: 600;
    }
    .graph-empty {
      margin: 0 0 0.5rem;
      font-family: var(--wiki-sans);
      font-size: 0.85rem;
    }
    .article {
      background: var(--paper);
      padding: 0.35rem 0 2rem;
      width: 100%;
      min-width: 0;
    }
    #gen-overlay {
      position: fixed; inset: 0;
      background: var(--overlay);
      display: flex; align-items: center; justify-content: center;
      z-index: 80;
      font-family: var(--wiki-sans);
    }
    #gen-overlay[hidden] { display: none !important; }
    .gen-box {
      text-align: center;
      padding: 1.25rem 1.5rem;
      border: 1px solid var(--border);
      background: var(--paper);
      min-width: 16rem;
    }
    .gen-box progress { width: 100%; margin-top: 0.75rem; }
    body.generating a.wikilink.new { pointer-events: none; opacity: 0.55; }
    /* Vector 2022: unpinned sidebars below 1000px */
    @media (max-width: 999px) {
      #btn-main-menu, #btn-ask { display: inline-flex; }
      #start-head, #end-head { display: none; }
      .vector-column-start, .vector-column-end { display: none; }
      .drawer-head { display: flex; }
      .header-account { display: none; }
      .sidebar-account { display: block; }
      .vector-column-start.open {
        display: block;
        position: fixed;
        top: var(--header-h); left: 0; bottom: 0;
        width: min(20rem, 92vw);
        background: var(--paper);
        border-right: 1px solid var(--border);
        overflow: auto;
        z-index: 45;
        padding: 0.75rem 1rem 1.25rem;
      }
      .vector-column-end.open {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: var(--header-h); right: 0; bottom: 0; left: 0;
        width: 100%;
        height: calc(100vh - var(--header-h));
        max-height: calc(100vh - var(--header-h));
        background: var(--bg);
        z-index: 46;
        overflow: hidden;
        min-height: 0;
      }
      .vector-column-end.open .chat-panel {
        flex: 1 1 0%;
        min-height: 0;
        overflow: hidden;
      }
      .vector-column-end.open .chat-composer {
        padding-bottom: max(0.6rem, env(safe-area-inset-bottom));
      }
    }
    @media (min-width: 720px) and (max-width: 999px) {
      .vector-column-end.open {
        left: auto;
        width: min(26rem, 92vw);
        border-left: 1px solid var(--border);
      }
    }
    /* Desktop: viewport-locked grid; each column scrolls on its own */
    @media (min-width: 1000px) {
      html, body { height: 100%; }
      body {
        display: flex;
        flex-direction: column;
        overflow: hidden;
      }
      .vector-header { flex: 0 0 auto; }
      .mw-page-container {
        flex: 1 1 0%;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
      }
      .col-first-head { height: 100%; }
      .mw-page-container-inner {
        flex: 1 1 0%;
        min-height: 0;
        overflow: hidden;
        width: 100%;
        grid-template-columns: 12.5rem minmax(0, 1fr) 18rem;
        grid-template-rows: auto minmax(0, 1fr);
        grid-template-areas:
          "start-head content-head end-head"
          "start content end";
        padding: 1.1rem 1.25rem 0.75rem;
      }
      .vector-column-start,
      .mw-body {
        align-self: stretch;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        max-height: none;
        height: auto;
      }
      .vector-column-end {
        display: flex;
        flex-direction: column;
        align-self: stretch;
        min-height: 0;
        overflow: hidden;
        height: auto;
        max-height: none;
      }
      .vector-column-end .chat-panel {
        flex: 1 1 0%;
        min-height: 0;
      }
    }
    @media (min-width: 1200px) {
      .mw-page-container-inner {
        grid-template-columns: 12.5rem minmax(0, 1fr) 24rem;
      }
      .vector-stats { display: inline; }
    }
    @media (max-width: 719px) {
      :root { --header-h: 4.6rem; }
      .vector-header { height: auto; min-height: var(--header-h); flex-wrap: wrap; padding-top: 0.35rem; padding-bottom: 0.35rem; }
      .vector-logo { font-size: 1.15rem; white-space: normal; flex: 1 1 8rem; line-height: 1.15; }
      .logo-aside { display: block; font-size: 0.68rem; margin-left: 0; }
      .dev-chip { padding: 0.25rem 0.4rem; font-size: 0.65rem; }
      .col-first-head h1 { font-size: 1.45rem; }
    }
    .article .lead-meta {
      font-family: system-ui, sans-serif;
      color: var(--muted);
      font-size: 0.8rem;
      margin-bottom: 1rem;
    }
    article p { margin: 0.65rem 0; }
    article h2 {
      font-family: "Linux Libertine", Georgia, serif;
      font-size: 1.35rem;
      font-weight: 400;
      border-bottom: 1px solid var(--border);
      margin: 1.4rem 0 0.5rem;
    }
    article ul { padding-left: 1.4rem; }
    details.wiki-section {
      margin-top: 1.25rem;
      border-top: 1px solid var(--border);
      padding-top: 0.5rem;
      font-family: system-ui, sans-serif;
      font-size: 0.88rem;
    }
    details.wiki-section > summary {
      cursor: pointer;
      font-weight: 600;
      font-size: 1.1rem;
      font-family: "Linux Libertine", Georgia, serif;
      list-style: none;
      padding: 0.35rem 0;
      color: var(--text);
    }
    details.wiki-section > summary::-webkit-details-marker { display: none; }
    details.wiki-section > summary::before {
      content: "▶ ";
      font-size: 0.7rem;
      color: var(--muted);
    }
    details.wiki-section[open] > summary::before { content: "▼ "; }
    details.wiki-section .inner {
      background: var(--ref-bg);
      border: 1px solid var(--border);
      padding: 0.6rem 0.85rem;
      margin-top: 0.35rem;
    }
    details.wiki-section ol, details.wiki-section ul {
      margin: 0.35rem 0 0;
      padding-left: 1.25rem;
    }
    details.wiki-section li { margin: 0.25rem 0; }
    .kind-block { margin-bottom: 0.65rem; }
    .kind-block > summary {
      cursor: pointer;
      font-weight: 600;
      color: var(--muted);
      font-size: 0.85rem;
      text-transform: uppercase;
      letter-spacing: 0.03em;
    }
    .entity-list {
      columns: 2;
      column-gap: 1rem;
      margin: 0.35rem 0 0;
      padding-left: 1.1rem;
      font-size: 0.85rem;
    }
    @media (max-width: 600px) {
      .entity-list { columns: 1; }
    }
    .entity-list li { break-inside: avoid; margin: 0.15rem 0; }
    .badge {
      display: inline-block;
      background: var(--badge-bg);
      color: var(--muted);
      font-size: 0.7rem;
      padding: 0 0.35rem;
      border-radius: 0;
      margin-left: 0.25rem;
      font-family: system-ui, sans-serif;
    }
    .sidebar {
      font-family: system-ui, sans-serif;
      font-size: 0.88rem;
    }
    .sidebar .box {
      background: var(--paper);
      border: 1px solid var(--border);
      padding: 0.85rem 1rem;
      margin-bottom: 0.75rem;
    }
    .sidebar h2 {
      margin: 0 0 0.5rem;
      font-size: 0.95rem;
      border-bottom: 1px solid var(--border);
      padding-bottom: 0.25rem;
      font-weight: 600;
    }
    .chat-panel {
      flex: 1 1 0%;
      min-height: 0;
      display: flex;
      flex-direction: column;
      border: 1px solid var(--border);
      background: var(--paper);
      overflow: hidden;
    }
    .chat-log {
      flex: 1 1 0%;
      min-height: 0;
      overflow-x: hidden;
      overflow-y: auto;
      padding: 0.7rem 0.75rem;
      -webkit-overflow-scrolling: touch;
    }
    .chat-empty { margin: 0.35rem 0; font-size: 0.85rem; }
    .chat-turn { margin: 0 0 0.85rem; }
    .chat-turn .who {
      font-family: var(--wiki-sans);
      font-size: 0.72rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--muted);
      margin: 0 0 0.2rem;
    }
    .chat-turn .bubble {
      border: 1px solid var(--border);
      background: var(--ref-bg);
      padding: 0.5rem 0.65rem;
      font-size: 0.85rem;
      line-height: 1.55;
      font-family: var(--wiki-sans);
      overflow-wrap: anywhere;
    }
    .chat-turn.user .bubble {
      background: var(--user-bubble);
      padding: 1rem 1.15rem;
    }
    .chat-turn.pending .bubble { color: var(--muted); font-style: italic; }
    .chat-composer {
      flex-shrink: 0;
      border-top: 1px solid var(--border);
      padding: 0.7rem 0.75rem 0.8rem;
      background: var(--ref-bg);
    }
    #ask-form {
      display: flex;
      flex-direction: column;
      gap: 0.45rem;
      border: 1px solid var(--border);
      background: var(--input-bg);
      padding: 0.7rem 0.75rem 0.6rem;
    }
    #ask-form textarea {
      width: 100%;
      min-width: 0;
      min-height: 5rem;
      max-height: 12rem;
      resize: none;
      padding: 0.65rem 0.7rem;
      border: 0;
      background: transparent;
      color: var(--text);
      font-size: 1rem;
      font-family: var(--wiki-sans);
      line-height: 1.45;
    }
    @media (min-width: 1000px) {
      #ask-form textarea { min-height: 6.5rem; }
    }
    /* --muted is body-text dark enough to read as typed input; placeholders use the lighter border tone. */
    #ask-form textarea::placeholder { color: var(--border); opacity: 1; }
    .chat-toolbar {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      gap: 0.5rem;
      height: auto;
      min-height: 2.1rem;
    }
    .chat-pickers {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
    }
    .model-picker {
      min-width: 0;
      flex: 1;
      height: 2.1rem;
    }
    .model-picker select {
      display: block;
      width: 100%;
      max-width: 100%;
      height: 100%;
      box-sizing: border-box;
      -webkit-appearance: none;
      appearance: none;
      font-family: var(--wiki-sans);
      font-size: 0.78rem;
      line-height: 2.1rem;
      background: var(--badge-bg);
      color: var(--text);
      border: 1px solid var(--border);
      padding: 0 1.6rem 0 0.55rem;
      cursor: pointer;
      background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
      background-position: calc(100% - 12px) calc(50% - 1.5px), calc(100% - 7px) calc(50% - 1.5px);
      background-size: 5px 5px, 5px 5px;
      background-repeat: no-repeat;
    }
    #ask-form button[type=submit] {
      flex: 0 0 2.1rem;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 2.1rem;
      height: 2.1rem;
      padding: 0;
      background: var(--accent);
      color: #fff;
      border: 1px solid var(--accent);
      cursor: pointer;
      font-size: 1.05rem;
      font-weight: 700;
      line-height: 0;
      font-family: var(--wiki-sans);
    }
    #ask-form button:disabled { opacity: 0.55; cursor: wait; }
    .answer-body { margin-bottom: 0.5rem; }
    /* Wikipedia-style superscript citation */
    sup.reference {
      font-size: 0.75em;
      line-height: 1;
      font-family: system-ui, sans-serif;
      font-weight: 600;
      margin: 0 0.05em;
    }
    sup.reference a {
      color: var(--cite-color);
      text-decoration: none;
      padding: 0 0.1em;
    }
    sup.reference a:hover { text-decoration: underline; }
    .answer-refs-wrap {
      margin-top: 0.75rem;
      padding-top: 0.5rem;
      border-top: 1px solid var(--border);
      font-family: system-ui, sans-serif;
      font-size: 0.8rem;
    }
    .answer-refs-label {
      font-weight: 600;
      font-size: 0.85rem;
      margin-bottom: 0.25rem;
      color: var(--muted);
    }
    ol.answer-refs {
      margin: 0.25rem 0 0;
      padding-left: 1.35rem;
    }
    ol.answer-refs li {
      margin: 0.3rem 0;
      scroll-margin-top: 0.5rem;
    }
    ol.answer-refs li:target {
      background: rgba(56, 139, 253, 0.15);
      outline: 1px solid var(--accent);
      border-radius: 0;
    }
    a.cite-back {
      color: var(--muted);
      text-decoration: none;
      margin-right: 0.15rem;
    }
    a.cite-back:hover { color: var(--link); }
    .muted { color: var(--muted); }
    code {
      font-size: 0.85em;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      background: var(--code-bg);
      padding: 0.05em 0.3em;
      border-radius: 0;
    }
    .suggested-types { font-size: 0.8rem; color: var(--muted); }
    .suggested-types code { margin-right: 0.35rem; }

    /* Dev RAG trace panel */
    details.dev-trace {
      margin-top: 0.65rem;
      border: 1px dashed var(--warn);
      border-radius: 0;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 0.72rem;
      background: var(--debug-bg);
    }
    details.dev-trace > summary {
      cursor: pointer;
      padding: 0.4rem 0.55rem;
      color: var(--warn);
      font-weight: 600;
      list-style: none;
      font-family: system-ui, sans-serif;
      font-size: 0.8rem;
    }
    details.dev-trace > summary::-webkit-details-marker { display: none; }
    details.dev-trace .trace-inner {
      padding: 0 0.55rem 0.65rem;
      max-height: 420px;
      overflow: auto;
      color: var(--muted);
    }
    details.dev-trace .trace-block {
      margin-top: 0.5rem;
      border-top: 1px solid var(--debug-border);
      padding-top: 0.4rem;
    }
    details.dev-trace .trace-label {
      color: var(--text);
      font-weight: 600;
      font-family: system-ui, sans-serif;
      font-size: 0.75rem;
      margin-bottom: 0.2rem;
    }
    details.dev-trace pre {
      margin: 0;
      white-space: pre-wrap;
      word-break: break-word;
      color: var(--text);
      line-height: 1.4;
    }
    details.dev-trace .kv { margin: 0.15rem 0; }
    details.dev-trace .kv b { color: var(--text); font-weight: 600; }

    .wiki-graph {
      height: min(70vh, 560px);
      border: 1px solid var(--border);
      background: var(--graph-bg);
      margin-top: 0.75rem;
    }
    @media (max-width: 719px) {
      .wiki-graph { height: 55vh; }
    }
    ul.category-list { padding-left: 1.2rem; }
    a.active-sort { font-weight: 700; text-decoration: underline; }
    #feedback-panel {
      display: none;
      margin: 0.75rem 0 1rem;
      font-family: system-ui, sans-serif;
      border: 1px solid var(--border);
      padding: 0.75rem;
      background: var(--ref-bg);
    }
    #feedback-panel.open { display: block; }
    #feedback-panel textarea {
      width: 100%;
      min-height: 6rem;
      background: var(--input-bg);
      color: var(--text);
      border: 1px solid var(--border);
      padding: 0.4rem;
    }
    #feedback-panel .warn { color: var(--warn); font-size: 0.8rem; }
    /* Edit chrome */
    .page-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem;
      align-items: center;
      font-family: system-ui, sans-serif;
      margin: 0 0 0.75rem;
      min-height: 1.5rem;
      padding-bottom: 0.2rem;
    }
    .page-actions button, .sidebar-btn {
      font-family: system-ui, sans-serif;
      font-size: 0.8rem;
      height: 1.5rem;
      padding: 0 0.55rem;
      display: inline-flex;
      align-items: center;
      border-radius: 0;
      border: 1px solid var(--border);
      background: var(--badge-bg);
      color: var(--text);
      cursor: pointer;
      box-sizing: border-box;
      line-height: 1;
    }
    .page-actions button:hover, .sidebar-btn:hover {
      border-color: var(--muted);
    }
    .page-actions button.primary, .sidebar-btn.primary {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
      font-weight: 600;
    }
    .page-actions button.danger {
      color: var(--danger);
      border-color: var(--danger);
      background: transparent;
    }
    .page-actions button:disabled { opacity: 0.55; cursor: wait; }
    .title-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; }
    .title-row h1 { flex: 1; min-width: 12rem; }
    #edit-panel {
      display: none;
      margin: 0.75rem 0 1rem;
      font-family: system-ui, sans-serif;
    }
    #edit-panel.open { display: block; width: 100%; min-width: 0; margin: 0 0 1rem; }
    #edit-panel label {
      display: block;
      font-size: 0.8rem;
      color: var(--muted);
      margin: 0.5rem 0 0.2rem;
    }
    #edit-panel input[type=text], #edit-panel textarea {
      width: 100%;
      padding: 0.45rem 0.5rem;
      border: 1px solid var(--border);
      background: var(--input-bg);
      color: var(--text);
      font-size: 0.9rem;
      border-radius: 0;
    }
    #edit-panel textarea {
      min-height: 280px;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 0.85rem;
      line-height: 1.45;
      resize: vertical;
    }
    #edit-panel .edit-hint {
      font-size: 0.75rem;
      color: var(--muted);
      margin-top: 0.35rem;
    }
    #edit-panel .edit-actions {
      display: flex;
      gap: 0.4rem;
      margin-top: 0.65rem;
      flex-wrap: wrap;
    }
    .toast {
      position: fixed;
      bottom: 1.25rem;
      right: 1.25rem;
      background: #238636;
      color: #fff;
      padding: 0.55rem 0.9rem;
      border-radius: 0;
      font-family: system-ui, sans-serif;
      font-size: 0.85rem;
      box-shadow: 0 4px 16px rgba(0,0,0,0.4);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s;
      z-index: 50;
    }
    .toast.show { opacity: 1; }
    .toast.err { background: #da3633; }
    .missing-create {
      margin: 1rem 0;
      padding: 0.85rem 1rem;
      border: 1px dashed var(--warn);
      border-radius: 0;
      font-family: system-ui, sans-serif;
      font-size: 0.9rem;
    }
    .ent-btn {
      font-family: system-ui, sans-serif;
      font-size: 0.7rem;
      padding: 0 0.3rem;
      margin-left: 0.15rem;
      border: 1px solid var(--border);
      background: transparent;
      color: var(--muted);
      border-radius: 0;
      cursor: pointer;
      vertical-align: middle;
      line-height: 1.4;
    }
    .ent-btn:hover { color: var(--text); border-color: var(--muted); }
    .ent-del:hover { color: var(--danger); border-color: var(--danger); }
    body.editing #ask-form { opacity: 0.45; pointer-events: none; }
    .dirty-dot {
      display: none;
      width: 0.45rem;
      height: 0.45rem;
      border-radius: 0;
      background: var(--warn);
      margin-left: 0.25rem;
    }
    .dirty-dot.on { display: inline-block; }
    #history-panel {
      display: none;
      margin: 0.75rem 0 1rem;
      font-family: system-ui, sans-serif;
      font-size: 0.88rem;
      border: 1px solid var(--border);
      background: var(--ref-bg);
      border-radius: 0;
      padding: 0.75rem 1rem;
    }
    #history-panel.open { display: block; }
    #history-panel h3 {
      margin: 0 0 0.5rem;
      font-size: 0.95rem;
    }
    .rev-list { list-style: none; margin: 0; padding: 0; }
    .rev-list li {
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem;
      align-items: center;
      padding: 0.4rem 0;
      border-top: 1px solid var(--border);
    }
    .rev-list li:first-child { border-top: none; }
    .rev-list .rev-label { flex: 1; min-width: 10rem; }
    .rev-list button {
      font-size: 0.75rem;
      padding: 0.2rem 0.45rem;
      border-radius: 0;
      border: 1px solid var(--border);
      background: var(--badge-bg);
      color: var(--text);
      cursor: pointer;
    }
    .rev-list button.primary {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
    }
    #rev-preview {
      display: none;
      margin-top: 0.75rem;
      border-top: 1px dashed var(--border);
      padding-top: 0.65rem;
    }
    #rev-preview.open { display: block; }
    #rev-preview pre {
      white-space: pre-wrap;
      word-break: break-word;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 0.8rem;
      max-height: 280px;
      overflow: auto;
      background: var(--input-bg);
      border: 1px solid var(--border);
      padding: 0.5rem 0.65rem;
      border-radius: 0;
      color: var(--text);
    }
    li.cite-human { color: var(--text); }
    li.cite-email .badge, li.cite-human .badge { margin-right: 0.25rem; }
    .site-footer {
      margin-top: 2.5rem;
      padding: 0.85rem 0 1.25rem;
      border-top: 1px solid var(--border);
      font-family: var(--wiki-sans);
      font-size: 0.78rem;
      color: var(--muted);
    }
    .site-footer p { margin: 0; }
    .site-footer a { color: var(--muted); text-decoration: none; }
    .site-footer a:hover { color: var(--link); }
    #help-overlay,
    #wiki-dialog-overlay {
      position: fixed; inset: 0;
      background: rgba(0,0,0,0.35);
      z-index: 70;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1rem;
    }
    #wiki-dialog-overlay { z-index: 75; }
    #help-overlay[hidden],
    #wiki-dialog-overlay[hidden] { display: none !important; }
    .help-box {
      background: var(--paper);
      color: var(--text);
      border: 1px solid var(--border);
      width: min(32rem, 100%);
      max-height: min(80vh, 36rem);
      overflow: auto;
      -webkit-overflow-scrolling: touch;
      font-family: var(--wiki-sans);
      font-size: 0.95rem;
    }
    .help-box .col-first-head {
      padding: 0.75rem 1rem 0.5rem;
    }
    .help-box .help-body { padding: 0.65rem 1rem 1.2rem; }
    .help-box .help-body p { margin: 0.25rem 0 0; line-height: 1.55; }
    #wiki-dialog-field-wrap { display: block; margin-top: 0.65rem; }
    #wiki-dialog-field-wrap[hidden] { display: none !important; }
    #wiki-dialog-input {
      display: block;
      width: 100%;
      margin-top: 0.35rem;
      padding: 0.45rem 0.5rem;
      border: 1px solid var(--border);
      background: var(--input-bg);
      color: var(--text);
      font-family: var(--wiki-sans);
      font-size: 1rem;
    }
    .wiki-dialog-actions {
      display: flex;
      justify-content: flex-end;
      gap: 0.4rem;
      margin-top: 0.85rem;
    }
    .wiki-dialog-actions button {
      font-family: var(--wiki-sans);
      font-size: 0.8rem;
      padding: 0.35rem 0.7rem;
      border: 1px solid var(--border);
      background: var(--badge-bg);
      color: var(--text);
      cursor: pointer;
    }
    .wiki-dialog-actions button.primary {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
    }
    .wiki-dialog-actions button.danger {
      background: var(--danger);
      border-color: var(--danger);
      color: #fff;
    }
    .wiki-dialog-list {
      list-style: none;
      margin: 0.5rem 0 0;
      padding: 0;
      font-size: 0.85rem;
    }
    .wiki-dialog-list li { margin: 0.35rem 0; }
    .ent-kind {
      font-family: var(--wiki-sans);
      font-size: 0.72rem;
      color: var(--text);
      background: var(--input-bg);
      border: 1px solid var(--border);
      margin-left: 0.25rem;
      max-width: 8.5rem;
      vertical-align: middle;
    }
    button.badge.ent-mentions {
      cursor: pointer;
      border: 1px solid var(--border);
      font: inherit;
      font-size: 0.7rem;
      color: var(--muted);
      background: var(--badge-bg);
    }
    .help-list { margin: 0; padding-left: 1.15rem; line-height: 1.5; }
    .help-list li { margin: 0.4rem 0; }
    .sidebar-account .js-delete-wiki { font-size: 0.78rem; }
    body.help-open { overflow: hidden; }
