@font-face { font-family: "Inter"; font-weight: 100 900; font-display: swap; src: url("fonts/inter-latin.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 100 900; font-display: swap; src: url("fonts/inter-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F; }
:root {
  --bg: #060a08;
  --panel: rgba(16, 24, 20, .55);
  --panel-hi: rgba(255, 255, 255, .055);
  --line: rgba(255, 255, 255, .085);
  --text: #e9f0eb; --muted: #9fb0a6; --faint: #7a8b82;
  --green: #46b072; --green-soft: rgba(70, 176, 114, .15); --mint: #b9d8c4;
  --amber: #e2ad55; --red: #e46d55;
  --bone: #e6dcc4; --cart: #8fc4de; --artery: #e0503f; --vein: #4f86d6; --nerve: #e9c25a; --muscle: #b9473f;
  --ease-out: cubic-bezier(.23, 1, .32, 1); --ease-io: cubic-bezier(.77, 0, .175, 1);
  --r: 18px; --flow: 1.4s; --beat: .83s;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  color: var(--text); font: 13px/1.5 Inter, "Segoe UI Variable Text", system-ui, sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1; -webkit-font-smoothing: antialiased;
  background: var(--bg); display: grid; grid-template-rows: 52px 1fr; overflow: hidden;
}
/* soft light behind the glass so the frost has something to bend */
body::before { content: ""; position: fixed; inset: -10%; z-index: -1; pointer-events: none;
  background: radial-gradient(40% 50% at 20% 30%, rgba(40, 120, 80, .28), transparent 70%),
              radial-gradient(35% 45% at 80% 70%, rgba(40, 90, 120, .22), transparent 70%),
              radial-gradient(30% 30% at 55% 15%, rgba(150, 60, 50, .12), transparent 70%);
  filter: blur(30px); }
::selection { background: rgba(70, 176, 114, .35); }
::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 8px; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 8px; }
svg [data-part]:focus-visible { outline: none; filter: drop-shadow(0 0 5px var(--green)); }

/* top bar */
.bar { display: flex; align-items: center; gap: 16px; padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -.01em; font-size: 14px; }
.brand svg { width: 20px; height: 20px; color: var(--green); }
.tabs { display: flex; gap: 2px; background: rgba(255,255,255,.04); padding: 3px; border-radius: 10px; position: relative; }
.tabs button { all: unset; position: relative; z-index: 1; padding: 5px 14px; border-radius: 8px; color: var(--muted); font-size: 12.5px; cursor: pointer; transition: color 150ms ease; }
.tabs button[aria-selected=true] { color: var(--text); }
.tabs .pill { position: absolute; top: 3px; bottom: 3px; border-radius: 8px; background: rgba(255,255,255,.09); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); transition: transform 260ms var(--ease-out), width 260ms var(--ease-out); }
.sp { flex: 1; }
.search { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; height: 32px; width: 240px; transition: border-color 150ms ease, background-color 150ms ease; }
.search:focus-within { border-color: rgba(70,176,114,.5); background: rgba(255,255,255,.07); }
.search svg { width: 15px; height: 15px; color: var(--faint); flex: none; }
.search input { all: unset; flex: 1; font-size: 12.5px; caret-color: var(--green); }
.search input::placeholder { color: var(--faint); }
.search kbd { font: 11px Inter; color: var(--faint); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; cursor: pointer; user-select: none; }
.sw { display: block; width: 30px; height: 18px; border-radius: 9px; background: rgba(255,255,255,.12); position: relative; transition: background-color 200ms ease; flex: none; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #dfe8e2; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform 220ms var(--ease-out); }
[aria-checked=true] .sw { background: var(--green); }
[aria-checked=true] .sw::after { transform: translateX(12px); }
.btn { all: unset; display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 10px; cursor: pointer; font-size: 12.5px; font-weight: 500;
  background: rgba(255,255,255,.06); border: 1px solid var(--line); transition: transform 160ms var(--ease-out), background-color 150ms ease; }
.btn:active { transform: scale(.97); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: rgba(70,176,114,.2); border-color: rgba(120,210,158,.3); color: #d6f2e1; box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: rgba(255,255,255,.1); }
  .btn.primary:hover { background: rgba(70,176,114,.3); }
  .tabs button:hover { color: var(--text); }
}

/* layout */
main { display: grid; grid-template-columns: 264px 1fr 340px; gap: 12px; padding: 0 12px 12px; min-height: 0; }
.panel { position: relative; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--panel-hi), 0 12px 32px -16px rgba(0,0,0,.6);
  backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%); min-height: 0; min-width: 0; }
.ph { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 500; padding: 0 4px; margin: 4px 0 8px; }
.ph .meta { margin-left: auto; color: var(--faint); font-weight: 400; }

/* rail */
.rail { padding: 14px 10px; overflow: auto; display: flex; flex-direction: column; gap: 18px; }
.list { display: flex; flex-direction: column; gap: 1px; }
.row { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 11px; cursor: pointer;
  transition: background-color 150ms ease, transform 160ms var(--ease-out); }
.row:active { transform: scale(.98); }
.row[aria-pressed=true], .row[aria-current=true] { background: rgba(255,255,255,.07); }
.row .ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.05); }
.row .ic i { width: 10px; height: 10px; border-radius: 50%; }
.row b { font-weight: 500; display: block; }
.row small { color: var(--muted); font-size: 11.5px; display: block; }
.row .end { color: var(--faint); font-size: 11.5px; }
@media (hover: hover) and (pointer: fine) { .row:hover { background: rgba(255,255,255,.05); } }
.conds { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cond { all: unset; padding: 9px 10px; border-radius: 12px; cursor: pointer; background: rgba(255,255,255,.04); border: 1px solid var(--line);
  transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease; }
.cond:active { transform: scale(.97); }
.cond b { display: block; font-weight: 500; font-size: 12.5px; }
.cond small { color: var(--muted); font-size: 11px; }
.cond[aria-pressed=true] { background: rgba(70,176,114,.16); border-color: rgba(120,210,158,.35); }
@media (hover: hover) and (pointer: fine) { .cond:hover { background: rgba(255,255,255,.07); } }
.slider { padding: 0 4px; }
.slider label { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.slider label b { color: var(--text); font-weight: 600; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(to right, var(--green) var(--p, 50%), rgba(255,255,255,.1) var(--p, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: #eef5f0; box-shadow: 0 2px 6px rgba(0,0,0,.45); transition: transform 150ms var(--ease-out); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: rgba(255,255,255,.1); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--green); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #eef5f0; }

/* stage */
.stage { overflow: hidden; }
.view { position: absolute; inset: 0; opacity: 0; filter: blur(6px); transform: scale(.985); pointer-events: none;
  transition: opacity 280ms var(--ease-out), filter 280ms var(--ease-out), transform 280ms var(--ease-out); }
.view.on { opacity: 1; filter: none; transform: none; pointer-events: auto; }
.hud { position: absolute; left: 14px; right: 14px; display: flex; align-items: center; gap: 12px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud.top { top: 12px; } .hud.bot { bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px; background: rgba(10,16,13,.6); border: 1px solid var(--line); color: var(--muted); font-size: 12px; backdrop-filter: blur(10px); }
.chip i { width: 7px; height: 7px; border-radius: 50%; }
.glass-card { background: rgba(10,16,13,.62); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; backdrop-filter: blur(12px); }
#v-body svg, #v-knee svg { position: absolute; inset: 44px 0 64px; width: 100%; height: calc(100% - 108px); }

/* body svg */
.g { transition: opacity 320ms var(--ease-out); }
.g.off { opacity: 0; pointer-events: none; }
.g.dim { opacity: .35; }
[data-part] { cursor: pointer; transition: filter 150ms ease; }
@media (hover: hover) and (pointer: fine) { [data-part]:hover { filter: brightness(1.3) drop-shadow(0 0 4px rgba(255,255,255,.25)); } }
[data-part].sel { filter: drop-shadow(0 0 6px rgba(70,176,114,.95)) brightness(1.15); }
.hit { fill: none; stroke: transparent; pointer-events: stroke; }
.b-o { fill: none; stroke: var(--bone); stroke-linecap: round; stroke-linejoin: round; }
.b-i { fill: none; stroke: #fffaf0; opacity: .45; stroke-linecap: round; stroke-linejoin: round; }
.b-f { fill: var(--bone); }
#g-skel { filter: drop-shadow(0 0 5px rgba(230,220,196,.22)); }
.skin { fill: #9fc9b0; }
.vessel { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.flow { fill: none; stroke-linecap: round; stroke-dasharray: 2 10; animation: flow var(--flow) linear infinite; }
.flow.in { animation-direction: reverse; }
@keyframes flow { to { stroke-dashoffset: -48; } }
.beat { transform-box: fill-box; transform-origin: center; animation: beat var(--beat) var(--ease-out) infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.12); } 30% { transform: scale(.97); } }
.nv { fill: none; stroke: var(--nerve); stroke-linecap: round; stroke-linejoin: round; }
.spark { fill: none; stroke: #fff6cf; stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 6 120; animation: spark 2.2s linear infinite; }
@keyframes spark { from { stroke-dashoffset: 126; } to { stroke-dashoffset: 0; } }
.joint circle.j { fill: rgba(143,196,222,.25); stroke: var(--cart); stroke-width: 1.5; }
.frac .core { fill: var(--red); }
.frac .ring { fill: none; stroke: var(--red); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: ring 2s var(--ease-out) infinite; }
@keyframes ring { from { transform: scale(.6); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
.crack { fill: none; stroke: #ff7b62; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; }
.crack.on { animation: draw 600ms var(--ease-out) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* eye */
#v-eye { display: grid; grid-template-rows: 1.15fr 1fr; gap: 10px; padding: 12px; }
.eyebox { position: relative; border-radius: 14px; overflow: hidden; background: radial-gradient(70% 90% at 50% 50%, rgba(255,255,255,.03), transparent); }
.eyebox svg { width: 100%; height: 100%; }
.lbl { fill: var(--muted); font-size: 11px; font-family: Inter, sans-serif; pointer-events: none; transition: opacity 200ms ease; }
.lead { stroke: rgba(255,255,255,.22); stroke-width: .8; fill: none; pointer-events: none; transition: opacity 200ms ease; }
.nolabels .lbl, .nolabels .lead { opacity: 0; }
.ray { fill: none; stroke: #fff3b0; stroke-width: 1.2; opacity: .8; stroke-dasharray: 5 7; animation: flow 1.2s linear infinite; }
.ray.virt { stroke-dasharray: 2 5; opacity: .4; animation: none; }
.press circle { fill: none; stroke: var(--amber); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: press 2.4s var(--ease-out) infinite; }
.press circle:nth-child(2) { animation-delay: .8s; } .press circle:nth-child(3) { animation-delay: 1.6s; }
@keyframes press { from { transform: scale(1.08); opacity: .8; } to { transform: scale(.7); opacity: 0; } }
#flap, #fluid, #lensCloud, #drusen, #dr, #press, #cup, #tmBlock, #cnv { transition: opacity 320ms var(--ease-out), transform 420ms var(--ease-out); }
#globe { transition: transform 420ms var(--ease-out); transform-origin: 128px 200px; }
.visbox { position: relative; display: grid; grid-template-rows: auto 1fr; gap: 8px; min-height: 0; }
.vishead { display: flex; align-items: center; gap: 10px; }
.vishead b { font-weight: 500; }
.seg { display: flex; gap: 2px; background: rgba(255,255,255,.05); padding: 2px; border-radius: 8px; margin-left: auto; }
.seg button { all: unset; padding: 3px 10px; border-radius: 6px; color: var(--muted); font-size: 12px; cursor: pointer; }
.seg button[aria-pressed=true] { background: rgba(255,255,255,.1); color: var(--text); }
.vis { position: relative; border-radius: 14px; overflow: hidden; min-height: 0; border: 1px solid var(--line); touch-action: none; }
.vis .layer { position: absolute; inset: 0; }
.vis .layer svg { width: 100%; height: 100%; display: block; }
.vis .aff { transition: filter 320ms var(--ease-out); }
.vis .ov { position: absolute; inset: 0; pointer-events: none; transition: opacity 320ms var(--ease-out); }
.handle { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,.9); box-shadow: 0 0 10px rgba(0,0,0,.5); cursor: ew-resize; }
.handle::after { content: ""; position: absolute; top: 86%; left: 50%; width: 28px; height: 28px; margin: -14px; border-radius: 50%; background: rgba(15,22,18,.8); border: 1.5px solid #fff; backdrop-filter: blur(6px); }
.handle::before { content: ""; position: absolute; inset: 0 -12px; }
.vtag { position: absolute; top: 10px; padding: 3px 9px; border-radius: 999px; background: rgba(8,12,10,.65); font-size: 11.5px; color: #e9f0eb; pointer-events: none; }

/* knee */
.kl { display: flex; gap: 4px; }
.kl i { flex: 1; height: 4px; border-radius: 4px; background: rgba(255,255,255,.1); transition: background-color 200ms ease; }
.kl i.on { background: var(--amber); }

/* info panel */
.info { display: flex; flex-direction: column; overflow: hidden; }
.info-body { padding: 18px 18px 8px; overflow: auto; flex: 1; animation: in 220ms var(--ease-out); }
@keyframes in { from { opacity: 0; transform: translateY(4px); } }
.info h1 { font-size: 22px; font-weight: 600; letter-spacing: -.025em; line-height: 1.15; text-wrap: balance; }
.info .latin { color: var(--muted); font-style: italic; margin-top: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 14px; }
.tag { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--muted); }
.tag.g { background: var(--green-soft); color: #a8e2c0; } .tag.r { background: rgba(228,109,85,.15); color: #f3b3a5; } .tag.a { background: rgba(226,173,85,.15); color: #f0d29e; }
.info p { color: #cdd8d1; margin-bottom: 10px; max-width: 65ch; }
.info h2 { font-size: 12px; font-weight: 500; color: var(--muted); margin: 18px 0 8px; }
.facts { display: grid; gap: 1px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: 112px 1fr; gap: 10px; padding: 8px 12px; background: rgba(255,255,255,.025); font-size: 12.5px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.clin { border-radius: 12px; padding: 10px 12px; background: rgba(226,173,85,.08); border: 1px solid rgba(226,173,85,.2); color: #ecdcbf; font-size: 12.5px; }
.clin b { color: var(--amber); font-weight: 600; }
.info-foot { padding: 12px 18px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.info-foot small { color: var(--faint); font-size: 11px; margin-left: auto; text-align: right; line-height: 1.3; }
.quiz { margin-top: 12px; }
.quiz .opt { all: unset; display: block; width: 100%; box-sizing: border-box; padding: 8px 12px; margin-top: 6px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.03); cursor: pointer; transition: background-color 150ms ease, border-color 150ms ease, transform 160ms var(--ease-out); }
.quiz .opt:active { transform: scale(.98); }
.quiz .opt.ok { background: rgba(70,176,114,.18); border-color: rgba(120,210,158,.45); }
.quiz .opt.no { background: rgba(228,109,85,.14); border-color: rgba(228,109,85,.4); }

.chip { white-space: nowrap; }
.search input { min-width: 0; }
@media (max-width: 1100px) { main { grid-template-columns: 230px 1fr 300px; } .search { width: 160px; } .search kbd { display: none; } .glass-card { width: auto !important; flex: 0 1 280px; min-width: 230px; } }
@media (max-width: 860px) {
  body { overflow: auto; grid-template-rows: auto auto; }
  .bar { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .search { order: 5; width: 100%; }
  main { grid-template-columns: 1fr; padding: 0 16px 16px; }
  .stage { height: 78vh; order: -1; } .rail, .info { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  .flow, .spark, .ray, .beat, .ring, .press circle { animation: none !important; }
  .view, .info-body { transition: opacity 200ms ease; transform: none !important; filter: none !important; animation: none; }
}