:root {
  color-scheme: dark;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-synthesis: none;
  line-height: 1.5;
  color: #dce7e4;
  background: #101d24;
  --muted: #a5b8bd;
  --line: #ffffff18;
  --accent: #a4d9cc;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; background: transparent; border: 0; padding: 8px 12px; min-height: 40px; border-radius: 5px; touch-action: manipulation; }
button:hover { background: #ffffff0a; }
button[aria-pressed=true] { background: #a4d9cc18; color: #c7eee2; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); }
h2, h3 { font: inherit; font-weight: 600; margin: 0 0 16px; }
p { margin: 0 0 16px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html { scrollbar-gutter: stable; }

header { height: 62px; display: flex; align-items: center; gap: 22px; padding: 0 32px; border-bottom: 1px solid var(--line); }
.brand { font-size: 16px; font-weight: 600; color: #f0f0e8; text-decoration: none; }
.header-subject { color: var(--muted); }
#about-open { margin-left: auto; color: var(--muted); }
.page-title { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 24px 32px; }
h1 { font-size: 28px; font-weight: 600; line-height: 1.25; margin: 0; }
.subtitle { margin: 6px 0 0; color: var(--muted); }
.anatomy-open { color: var(--accent); align-self: end; }
main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; padding: 0 32px 24px; max-width: 2100px; margin: auto; }
.model-study { min-width: 0; }
.model-toolbar { display: flex; align-items: center; margin-bottom: 8px; }
.views { display: flex; gap: 2px; }
#stage { position: relative; height: clamp(360px, calc(100dvh - 375px), 850px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden; border-radius: 7px; background: #14262f; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#loading { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; background: #14262f; }
#joint-viewport, #arm-viewport { position: relative; min-width: 0; overflow: hidden; touch-action: none; cursor: grab; outline-offset: -3px !important; }
#joint-viewport:active, #arm-viewport:active, #anatomy-scene:active { cursor: grabbing; }
#joint-viewport[data-attachment-hover] { cursor: pointer; }
#joint-viewport { border-right: 1px solid var(--line); }
#joint-viewport, #arm-viewport, #anatomy-viewport { user-select: none; -webkit-user-select: none; }
.view-caption { position: absolute; left: 19px; top: 17px; z-index: 2; pointer-events: none; }
.view-caption strong { font: inherit; font-weight: 600; }
#labels, #leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#leaders { overflow: visible; }
#leaders line { stroke-linecap: round; vector-effect: non-scaling-stroke; }
#leaders .leader-halo { stroke: #10212b; stroke-width: 4.5; opacity: .92; }
#leaders .leader-line { stroke: #d2e7e1; stroke-width: 1.8; opacity: 1; }
#leaders circle { fill: #d2e7e1; stroke: #10212b; stroke-width: 1.5; }
.anatomy-label { position: absolute; font-size: 12px; line-height: 1.4; white-space: nowrap; color: #e0ede9; background: #13242cf2; padding: 5px 7px; border-radius: 4px; }
.anatomy-label.head { color: #f1c4a6; }
.anatomy-label.socket { color: #b1ded5; }
.attachment-readout { --attachment-color: #e9ba66; position: absolute; bottom: 18px; left: 19px; max-width: calc(100% - 38px); display: flex; align-items: center; gap: 10px; padding: 11px 13px; background: #10212bf5; border: 1px solid #6c89854d; border-radius: 8px; box-shadow: 0 5px 18px #06151d40; pointer-events: none; z-index: 3; }
.attachment-readout[data-site=insertion] { --attachment-color: #b2dc91; }
.attachment-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--attachment-color); }
#attachment-name, #attachment-site { display: block; font: inherit; }
#attachment-name { font-weight: 600; }
#attachment-site { margin-top: 2px; color: var(--muted); }
#attachment-dismiss { pointer-events: auto; align-self: stretch; min-width: 40px; min-height: 40px; margin: -7px -9px -7px 4px; padding: 0; color: var(--muted); font-size: 22px; }

.playback { display: flex; align-items: center; gap: 12px; padding: 14px 0 10px; }
#play { background: var(--accent); color: #18362f; min-width: 82px; }
#restart { padding: 0; min-width: 32px; font-size: 22px; color: var(--muted); }
.timeline { flex: 1; min-width: 0; }
#progress { width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; display: block; }
#rotation { min-width: 68px; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.display-options { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 8px 0 0; }
.display-options label { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; cursor: pointer; }
input[type=checkbox] { accent-color: var(--accent); margin: 0; width: 14px; height: 14px; }

aside { padding: 0 0 0 4px; min-width: 0; }
#steps { display: flex; justify-content: space-between; gap: 5px; margin-bottom: 22px; }
#steps button { width: 40px; padding: 0; border-radius: 0; border-bottom: 2px solid transparent; color: var(--muted); }
#steps button[aria-current=step] { border-bottom-color: var(--accent); color: #e5eee8; }
.teaching { font: inherit; }
.teaching h2 { margin-bottom: 14px; }
#step-pearls { margin: 0; padding-left: 18px; }
#step-pearls li { margin: 0 0 12px; padding-left: 2px; line-height: 1.6; }

 dialog { background: #172a32; color: #dce7e4; border: 1px solid #ffffff28; border-radius: 8px; width: min(720px, 94vw); padding: 0; max-height: 85dvh; }
dialog::backdrop { background: #030b10ce; backdrop-filter: blur(4px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; }
.dialog-header button { font-size: 24px; padding: 0 8px; }
.dialog-content { padding: 20px 24px 24px; }
.dialog-content p, .dialog-content li { font: inherit; }
.dialog-content h3 { margin: 24px 0 12px; }
.dialog-content ol, .dialog-content ul { margin: 0 0 20px; padding-left: 20px; }
.dialog-content li { margin-bottom: 14px; }
#anatomy-dialog { width: min(1000px, 95vw); max-height: 92dvh; }
#anatomy-viewport { width: 100%; height: min(40dvh, 390px, calc(92dvh - 330px)); min-height: 180px; background: #14262f; }
#anatomy-scene { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.anatomy-window-controls { display: flex; align-items: center; gap: 14px; padding: 8px 22px; }
.anatomy-window-controls [role=group] { display: flex; gap: 3px; }
.muscle-table { padding: 0 22px 18px; }
#anatomy-dialog table { width: 100%; border-collapse: collapse; table-layout: fixed; font: inherit; text-align: left; }
#anatomy-dialog th, #anatomy-dialog td { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); line-height: 1.5; vertical-align: top; }
#anatomy-dialog th { font-weight: 600; }
#anatomy-dialog td:first-child, #anatomy-dialog th:first-child { width: 31%; }
#anatomy-dialog td:nth-child(2), #anatomy-dialog th:nth-child(2) { width: 31%; }
#anatomy-dialog [data-muscle] { text-align: left; min-height: 32px; padding: 4px 8px; margin: -4px 0 -4px -8px; max-width: 100%; }
#anatomy-dialog tr.selected { background: #a4d9cc14; }
#anatomy-dialog [data-muscle][aria-pressed=true] { background: transparent; color: var(--accent); }

@media (min-width: 1600px) {
  main { grid-template-columns: minmax(0, 1fr) 360px; gap: 38px; }
}
@media (max-width: 1250px) and (min-width: 801px) {
  header { padding: 0 22px; }
  .page-title { padding: 24px 22px; }
  main { display: block; padding: 0 22px 24px; }
  aside { margin-top: 28px; padding: 0; max-width: 760px; }
  #steps { max-width: 350px; }
}
@media (max-width: 800px) {
  header { height: 56px; gap: 12px; padding: 0 18px; }
  .header-subject { display: none; }
  .page-title { display: block; padding: 20px 18px 12px; }
  h1 { font-size: 24px; }
  .anatomy-open { margin-top: 12px; padding-left: 0; }
  main { display: flex; flex-direction: column; gap: 28px; padding: 0 16px 26px; }
  .views { gap: 0; }
  .views button { padding: 8px; }
  #stage { height: 690px; grid-template-columns: 1fr; grid-template-rows: 370px 70px 250px; }
  #joint-viewport { grid-row: 1; border-right: 0; }
  #arm-viewport { grid-row: 3; }
  .view-caption { top: 14px; left: 15px; }
  #stage .playback { grid-row: 2; position: relative; z-index: 2; background: #101d24; gap: 8px; padding: 12px 0; }
  #play { min-width: 76px; }
  #rotation { min-width: 64px; }
  .display-options { gap: 8px 14px; padding-top: 8px; }
  .attachment-readout { left: 15px; max-width: calc(100% - 30px); }
  aside { padding: 0; }
  #steps { max-width: 350px; margin-bottom: 20px; }
  .dialog-header { padding: 12px 16px; }
  .dialog-content { padding: 18px 20px; }
  #anatomy-viewport { height: min(30dvh, 260px); }
  .anatomy-window-controls { padding: 8px 16px; gap: 8px; }
  .anatomy-window-controls button { padding: 8px; }
  .muscle-table { padding: 0 16px 14px; }
  #anatomy-dialog th, #anatomy-dialog td { padding-right: 8px; }
}

.title-actions { display:flex; align-items:center; gap:18px; }
.title-actions a { white-space:nowrap; }
.lesson-scope { padding:0 32px; max-width:2100px; margin:0 auto 18px; color:var(--muted); }
#anatomy-viewport { position:relative; }
#nerve-leader { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
#nerve-leader .leader-halo { stroke:#10212b; stroke-width:5; }
#nerve-leader .leader-line { stroke:#f5ca37; stroke-width:2; }
#nerve-leader circle { fill:#f5ca37; stroke:#10212b; stroke-width:1.5; }
.anatomy-nerve-label { position:absolute; left:18px; top:20px; padding:5px 7px; background:#13242cf2; border-radius:4px; color:#f5ca37; pointer-events:none; }
@media(max-width:800px) { .title-actions { justify-content:space-between; gap:12px; margin-top:8px; } .title-actions .anatomy-open { margin:0; } .lesson-scope { padding:0 18px; } }

#bone-layer { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
#sequence-nerve-leader { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
#sequence-nerve-leader .leader-halo { stroke:#10212b; stroke-width:5; }
#sequence-nerve-leader .leader-line { stroke:#f5ca37; stroke-width:2; }
#sequence-nerve-leader circle { fill:#f5ca37; stroke:#10212b; stroke-width:1.5; }
#sequence-nerve-label { color:#f5ca37; pointer-events:none; }
#reference-banner { position:absolute; left:18px; top:46px; color:var(--muted); font-size:12px; pointer-events:none; }
.display-options label:has(input:disabled) { opacity:.45; cursor:default; }

.demo-disclaimer { max-width:1100px; margin:0 auto; padding:20px 32px 28px; color:var(--muted); border-top:1px solid var(--line); }
.demo-disclaimer p { margin:0; }
@media(max-width:800px) { .demo-disclaimer { padding:20px 18px 26px; } }
