/* Shared navigation and control surfaces for the simulation and the teaching library. */
html:has(>body.sim-section){background:#081e25}
body.sim-section{
  --ink:#ecf7f5;--muted:#b3c9cb;--pale:#b3c9cb;--line:#36545b;--edge:#36545b;
  --teal:#9ee8d7;--paper:#102e36;--panel:#102e36;--bg:#081e25;--inset:#0b252c;
  color-scheme:dark;color:var(--ink);background:var(--bg);min-height:100vh;
  font-family:"Segoe UI",Arial,sans-serif;font-variant-numeric:tabular-nums
}
.sim-section .sim-nav{
  display:flex;align-items:center;flex-wrap:wrap;gap:4px;margin:0;padding:5px;
  width:fit-content;max-width:100%;background:var(--inset);border:1px solid var(--edge);border-radius:9px
}
.sim-section .sim-nav a,.sim-section .topbar .sim-nav a:first-child{
  display:inline-flex;align-items:center;justify-content:center;padding:7px 11px;border:1px solid transparent;
  border-radius:6px;text-decoration:none;color:#c5d9da;font-size:14px;font-weight:550;line-height:1.25
}
.sim-section .sim-nav a[aria-current=page],.sim-section .sim-nav a:hover{
  color:#c5ffed;background:#1e4948;border-color:#497c73
}
.sim-section>.sim-nav{margin:12px auto}
.bs-screen>.sim-nav{display:none}
.sim-section .topbar,.sim-section header{background:var(--bg);border-color:var(--edge)}
.sim-section .topbar .wrap,.sim-section[data-section=diagnoses] header{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;height:auto;padding-block:10px}
.sim-section:not(.bs-screen) :is(h1,h2,h3,h4,legend){color:var(--ink)}
.sim-section:not(.bs-screen) h1{font-size:clamp(26px,3.4vw,44px);line-height:1.1;letter-spacing:-.035em}
.sim-section a{color:var(--teal);text-underline-offset:3px}
.sim-section :focus-visible{outline:2px solid #7de9ce;outline-offset:2px}
.sim-section:not(.bs-screen) :is(.card,.state-picker,.state-pathology,.transport,dialog,#protocols,#scenario-builder,#circulation-lines,.trend,.advanced,.device-row),
.sim-section:is([data-section=evidence],[data-section=mapping]) main>section{
  background:var(--panel);border-color:var(--edge);color:var(--ink);border-radius:11px
}
.sim-section:not(.bs-screen) :is(.state-normal,.purpose,.state-options a,.edu,.tabs,.view-switch,.proto-toggle,.proto-cause,.state-open,.hint,.chain>div,.device-body,.drain-device,.exam-grid>div,#zone-cells>div,.metric,.tone-caution){
  background:#17383e;color:#d5ebe7;border-color:var(--edge)
}
.sim-section:not(.bs-screen) :is(small,.muted,figcaption,.patient,.legend,.lead,.notice,.help,.caption,.state-subtitle,.state-readings dt,.state-more summary,.card-heading p,.trend span,.metric span,.metric em,.metric small,.sectionhead span,.builder-hint,#stage-order small,.title p,.proto-disclosure,#abg-context td){
  color:var(--muted)
}
.sim-section:not(.bs-screen) :is(button,select,textarea,input[type=number],dialog input),
.bs-screen .bs-pane :is(textarea,select,input[type=number]){
  background:#173940;color:var(--ink);border:1px solid #44636a;border-radius:6px
}
.sim-section :is(input[type=range],input[type=checkbox],input[type=radio]){accent-color:#69d6bc}
.sim-section:not(.bs-screen) :is(button:hover,select:hover,.state-options a:hover,.stage-options label:has(:checked),.proto-option:has(:checked),.tabs button[aria-selected=true],.view-switch button[aria-pressed=true]){
  color:#dcfff6;background:#22514e;border-color:#579e90
}
.sim-section:not(.bs-screen) :is(.primary,#apply,#launch-sequence,.proto-preview){background:#176658;color:#effffa;border-color:#438c7f}
.sim-section :is(.casebook summary,#scenario-origin,#circulation-receipt,.state-normal .state-open){color:var(--teal)}
.sim-section :is(.casebook li,.stage-options label,details,.abg-table td,.abg-table th,table td,table th){border-color:var(--edge)}
.sim-section:not(.bs-screen) :is(thead th,.proto-table thead,.abg-table th[scope=rowgroup],.proto-table tbody th){background:#19383e;color:var(--ink)}
.sim-section:is([data-section=evidence],[data-section=mapping]) tbody tr:nth-child(odd){background:var(--inset)}
.sim-section :is(#diagram-frame,#hydraulic-view,#hemo-live .diagram-frame,.bs-pane #hemo-live){background:#e4eeea;color:#163a40;border-radius:8px}
.sim-section .bs-pane :is(.metric span,.metric em,.metric small,.drain-caption,#abg-context td,.legend,.drain-device small){color:var(--muted)}
.sim-section .bs-pane :is(#film-pair figure,#film-pair figcaption){color:var(--ink)}
.sim-section .bs-pane :is(.alarm-trends,.infusion-pump,#surfactant-procedure,.device-body){background:var(--inset);color:var(--ink);border-color:var(--edge)}
.sim-section .bs-pane .abg-table th[scope=rowgroup]{background:#1d4146}
.sim-section .bs-pane #hemo-live small{color:#385a56}
.sim-section .bedside-dock,.sim-section .bedside-dock #device-panel[open]>.device-body{background:var(--panel);color:var(--ink);border-color:var(--edge)}
.sim-section #abg-context td,.sim-section #stage-order,.sim-section #scenario-origin{color:#c6e4df}
.sim-section[data-section=ventilation]:not(.bs-screen) .bedside-dock summary{color:var(--ink)}
@media(max-width:849px){
  .sim-section:not(.bs-screen) .bedside-dock{position:static}
  .sim-section:not(.bs-screen) .bedside-dock #alarm-bar{white-space:normal;overflow:visible;max-height:none}
}
.sim-section .film-library,.sim-section .casebook{max-width:1060px;margin:0 auto;padding:clamp(16px,3vw,32px)}
.sim-section .film-library h1{margin-bottom:10px}
.sim-section .film-library .lead{max-width:76ch;margin:0 0 24px;line-height:1.5}
.film-index{margin:0 0 22px;border:1px solid var(--edge);border-radius:9px;background:var(--panel);padding:0 14px}
.film-index summary{cursor:pointer;font-weight:650;padding:12px 0}
.film-index ol{columns:2;column-gap:30px;padding-left:24px;margin:0 0 14px}
.film-index li{break-inside:avoid;padding:4px 0;font-size:14px}
.film-grid figure:target{outline:2px solid #79d9c0;outline-offset:2px}
@media(max-width:610px){.film-index ol{columns:1}}
.film-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,255px),1fr));gap:14px}
.film-grid figure{margin:0;min-width:0;background:var(--panel);border:1px solid var(--edge);border-radius:10px;overflow:hidden}
.film-grid figure>a{display:block;background:#101719}
.film-grid img{display:block;width:100%;height:auto}
.film-grid figcaption{padding:12px 14px}
.sim-section .film-grid h2{font-size:17px;line-height:1.25;margin:0}
.film-grid p{font-size:14px;margin:5px 0 9px}
.film-grid figcaption a{font-size:14px;font-weight:600}
@media(max-width:849px){
  .sim-section:not(.bs-screen)>header,.sim-section .topbar .wrap{height:auto;min-height:0;flex-wrap:wrap;padding-block:10px}
  .sim-section>.sim-nav{margin:8px auto;width:calc(100% - 20px)}
  .sim-section .sim-nav a,.sim-section .topbar .sim-nav a:first-child{flex:1 0 auto;min-height:44px;font-size:13px;padding:5px 8px}
  .sim-section:not(.bs-screen) :is(button,select,summary,input[type=range]){min-height:44px}
  .sim-section:not(.bs-screen) nav{max-width:100%;flex-wrap:wrap}
  .sim-section .topbar .sim-nav,.sim-section[data-section=diagnoses] .sim-nav{width:100%}
}
@media print{
  .sim-section .sim-nav{display:none}
  body.sim-section{color-scheme:light;--bg:white;--paper:white;--panel:white;--ink:#182d31;--teal:#145b52;--muted:#3b5357;--inset:#f2f7f7}
}
