/* Shared appearance controls for the guide and economy documentation. */
.docs-appearance{display:flex;justify-content:flex-end;padding-top:14px}
.docs-theme{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:3px;padding:3px;border:1px solid var(--line);border-radius:10px;background:var(--surface)}
.docs-theme-label{padding-inline:10px 9px;color:var(--muted);font-size:12px;font-weight:600}
.docs-theme button{min-height:44px;min-width:68px;padding:8px 12px;border:1px solid transparent;border-radius:7px;background:transparent;color:var(--ink);font:inherit;font-size:12px;font-weight:600;line-height:1.4}
.docs-theme button:hover{background:var(--soft)}
.docs-theme button[aria-pressed=true]{background:var(--ink);border-color:var(--ink);color:var(--paper)}
.docs-theme button:focus-visible{outline:3px solid var(--accent);outline-offset:3px}

.docs-world{display:flex;align-items:center;gap:8px;padding-inline:9px;font-size:12px;color:var(--muted)}
.docs-world select{min-height:44px;max-width:160px;padding:8px 24px 8px 10px;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--ink);font:inherit}
.docs-world select:focus-visible{outline:3px solid var(--accent);outline-offset:3px}

/* Keep print and exported diagrams in their original light appearance. */
@media screen{
  html[data-docs-theme]{color-scheme:light}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]){
    color-scheme:dark;
    --paper:#171e1b;
    --surface:#202a25;
    --ink:#edf0e8;
    --muted:#b7c1b7;
    --line:#445348;
    --accent:#bed69d;
    --soft:#2c392b;
    background:var(--paper);
    color:var(--ink);
  }
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) body:is([data-page=guide],[data-page=economy]){
    --muted:#b7c1b7;
    background:var(--paper);
    color:var(--ink);
  }
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) :is(button,a,input,select,summary):focus-visible{outline-color:var(--accent)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .button,
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .skip{background:var(--accent);border-color:var(--accent);color:#1c281a}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .button:hover{background:var(--ink);border-color:var(--ink)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .button.secondary{background:transparent;border-color:var(--line);color:var(--ink)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .button.secondary:hover{background:var(--soft)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .guide-callout{border-color:var(--line)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) :is(.guide-callout p,.callout-symbol){color:var(--ink)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) body[data-page=guide] .guide-toc nav a{background:transparent}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) body[data-page=guide] .guide-toc nav a:is(:hover,.active){background:var(--soft);color:var(--accent)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) body[data-page=guide] .faq details p a{color:var(--accent)}

  /* Economy styles define their own palette; override it at the same boundary. */
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy{
    --cream:var(--paper);
    --ink:inherit;
    --muted:inherit;
    --line:inherit;
    --money:#edbd70;
    --spark:#c6a8ef;
    --stock:#9acb9d;
    --attention:#8ecbd9;
  }
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy :is(.chart-card,.example,.tools button){background:var(--surface)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy .chart-card{box-shadow:0 12px 40px #0000001f}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy :is(.detail,.equation .box){background:var(--soft)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy :is(.note,.planned-banner){background:#302a3d;border-color:#8c76aa}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy .note{border-left-color:var(--spark)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy .tabs button:hover,
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy .tools button:hover{background:var(--soft)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy .tabs button[aria-selected=true]{background:var(--accent);border-color:var(--accent);color:#1c281a}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy .viewport{background-color:var(--surface);background-image:radial-gradient(#435047 1px,transparent 1px)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy .node rect{fill:var(--surface);stroke:var(--muted)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy .node:is(:hover,.selected) rect{fill:var(--soft);stroke:var(--accent)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy .node .sub{fill:var(--muted)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy .node:focus-visible{outline-color:var(--accent)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy .edge-label{stroke:var(--surface)}
  /* Race palettes change documentation only, never the resident or tower. */
  html[data-docs-theme="bibt"]{--paper:#101714;--surface:#1d2623;--ink:#f2edde;--muted:#c9c5b5;--line:#5b6053;--accent:#dfc58b;--soft:#303a30}
  html[data-docs-theme="bibt"] body:is([data-page=guide],[data-page=economy]){--muted:#c9c5b5}
  html[data-docs-theme="bibt"] .header{border-bottom:2px solid transparent;border-image:linear-gradient(90deg,#b83d4b,#dfc58b 48%,#48b9c4) 1}
  html[data-docs-theme="bibt"] .guide-intro{background:linear-gradient(115deg,#dfc58b0d,transparent 65%)}
  html[data-docs-theme="aliens"]{--paper:#d0dcd5;--surface:#e5eee8;--ink:#203c35;--muted:#435e53;--line:#96ada1;--accent:#2b625b;--soft:#becfc4}
  html[data-docs-theme="heaven"]{--paper:#e7eff7;--surface:#f7fbff;--ink:#253f56;--muted:#52667b;--line:#b8c8d8;--accent:#496d8d;--soft:#d7e4f0}
  html:is([data-docs-theme="aliens"],[data-docs-theme="heaven"]){background:var(--paper);color:var(--ink)}
  html:is([data-docs-theme="aliens"],[data-docs-theme="heaven"]) body[data-page=guide]{--muted:inherit}
  html:is([data-docs-theme="aliens"],[data-docs-theme="heaven"]) .economy{--cream:var(--paper);--ink:inherit;--muted:inherit;--line:inherit}
  html:is([data-docs-theme="aliens"],[data-docs-theme="heaven"]) :is(.chart-card,.example,.tools button){background:var(--surface)}
  html:is([data-docs-theme="aliens"],[data-docs-theme="heaven"]) :is(.detail,.equation .box){background:var(--soft)}
  html:is([data-docs-theme="aliens"],[data-docs-theme="heaven"]) .viewport{background-color:var(--surface)}
  html:is([data-docs-theme="aliens"],[data-docs-theme="heaven"]) .node rect{fill:var(--surface);stroke:var(--muted)}
  html:is([data-docs-theme="aliens"],[data-docs-theme="heaven"]) .node:is(:hover,.selected) rect{fill:var(--soft);stroke:var(--accent)}

  /* SVG presentation attributes are also used by the standalone light export. */
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy svg [fill="#aa6710"]{fill:var(--money)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy svg [fill="#7651b7"]{fill:var(--spark)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy svg [fill="#32754b"]{fill:var(--stock)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy svg [fill="#28758a"]{fill:var(--attention)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy svg [stroke="#aa6710"]{stroke:var(--money)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy svg [stroke="#7651b7"]{stroke:var(--spark)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy svg [stroke="#32754b"]{stroke:var(--stock)}
  html:is([data-docs-theme="dark"],[data-docs-theme="apes"],[data-docs-theme="bibt"]) .economy svg [stroke="#28758a"]{stroke:var(--attention)}
}

@media(max-width:550px){
  .docs-appearance{padding-top:10px}
  .docs-theme{padding:4px;justify-content:flex-start;max-width:100%}
  .docs-world{flex-basis:100%;padding:2px 7px;justify-content:space-between}
  .docs-world select{flex:1;max-width:none}
  .docs-theme-label{padding-inline:8px 6px}
  .docs-theme button{min-width:64px;padding-inline:10px}
}
@media print{.docs-appearance{display:none}}
