/* Soma: surgical-green specimen theatre, gentian-violet interaction, atlas-plate typography */
:root,
[data-theme="dark"] {
  --bg: #0f2420;
  --panel: rgba(20, 44, 39, 0.74);
  --panel-solid: #15302a;
  --line: rgba(222, 238, 232, 0.11);
  --line-2: rgba(222, 238, 232, 0.22);
  --ink: #e8efeb;
  --ink-2: #aac0b9;
  --ink-3: #7c958e;
  --accent: #b9a2ff;
  --accent-ink: #1d1238;
  --accent-soft: rgba(185, 162, 255, 0.16);
  --leader: rgba(232, 239, 235, 0.52);
  --shadow: 0 18px 50px -24px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #e6eeea;
  --panel: rgba(247, 251, 249, 0.8);
  --panel-solid: #f4f8f6;
  --line: rgba(16, 36, 31, 0.09);
  --line-2: rgba(16, 36, 31, 0.18);
  --ink: #10241f;
  --ink-2: #48615a;
  --ink-3: #7b908a;
  --accent: #5b34c9;
  --accent-ink: #ffffff;
  --accent-soft: rgba(91, 52, 201, 0.11);
  --leader: rgba(16, 36, 31, 0.48);
  --shadow: 0 18px 50px -26px rgba(16, 36, 31, 0.35);
  color-scheme: light;
}
body.xray {
  --leader: rgba(196, 226, 255, 0.5);
}
body.xray[data-theme],
[data-theme] body.xray {
  --panel: rgba(10, 22, 30, 0.72);
  --line: rgba(196, 226, 255, 0.12);
  --line-2: rgba(196, 226, 255, 0.22);
  --ink: #e4f0f8;
  --ink-2: #9db6c6;
  --ink-3: #6f8898;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
body {
  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
  font-size: 14px; line-height: 1.45; color: var(--ink);
  -webkit-font-smoothing: antialiased; font-feature-settings: 'tnum' 0;
  transition: color .4s;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg { stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

#viewport { position: fixed; inset: 0; }
#viewport canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#overlay { position: fixed; inset: 0; pointer-events: none; z-index: 2; }

/* ---------------------------------------------------------------- atlas labels */
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.leader { stroke: var(--leader); stroke-width: 0.9; fill: none; opacity: 0; transition: opacity .35s; }
.leader.on { opacity: 1; }
.leader.primary { stroke: var(--accent); stroke-width: 1.2; }
.leader-dot { fill: var(--bg); stroke: var(--leader); stroke-width: 1.2; opacity: 0; transition: opacity .35s; }
.leader-dot.on { opacity: 1; }
.leader-dot.primary { stroke: var(--accent); fill: var(--accent); }
.label-layer { position: absolute; inset: 0; }
.atlas-label {
  position: absolute; left: 0; top: 0; pointer-events: auto;
  display: flex; flex-direction: column; align-items: flex-end; gap: 0;
  padding: 3px 4px; border-radius: 6px; max-width: 220px; text-align: right;
  opacity: 0; transition: opacity .35s, background-color .2s; will-change: transform;
}
.atlas-label.right { align-items: flex-start; text-align: left; }
.atlas-label.on { opacity: 1; }
.atlas-label:not(.on) { pointer-events: none; }
.atlas-label:hover { background: var(--accent-soft); }
.atlas-label { --halo: color-mix(in srgb, var(--bg) 82%, transparent); }
.al-name, .al-latin { text-shadow: 0 0 3px var(--halo), 0 0 8px var(--halo), 0 0 14px var(--halo); }
.al-name { font-size: 13px; font-weight: 500; letter-spacing: 0.005em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: var(--mw, 220px); }
.al-latin { font-family: 'EB Garamond', Georgia, serif; font-style: italic; font-size: 13.5px; line-height: 1.15; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: var(--mw, 220px); }
.al-latin:empty { display: none; }
.atlas-label.primary .al-name { color: var(--accent); font-weight: 600; font-size: 14px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 360px) minmax(min-content, 1fr); align-items: center; gap: 16px;
  padding: 14px 18px; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
/* logo: layered brandmark (skin, tissue, core resting on one point) + wordmark + short tagline */
.logo { display: flex; align-items: center; gap: 10px; flex: none; }
.brandmark { width: 34px; height: 34px; flex: none; overflow: visible; }
.brandmark circle { fill: none; stroke-width: 1.5; }
.brandmark .bm-o { stroke: var(--ink); }
.brandmark .bm-m { stroke: var(--accent); opacity: .72; }
.brandmark .bm-i { fill: var(--accent); stroke: none; }
.logo-text { display: flex; flex-direction: column; gap: 3px; }
.logo .wordmark { font-size: 28px; }
.logo-tag { font-size: 9.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; line-height: 1; }
body.organ-mode .logo-tag { display: none; }       /* the breadcrumb takes over as the subtitle */
@media (max-width: 1500px) { body.organ-mode .logo-text { display: none; } }   /* narrower screens: the mark alone, so the breadcrumb fits */
.loader-logo { display: flex; align-items: center; justify-content: center; gap: 16px; }
.brandmark.big { width: 66px; height: 66px; }
.brandmark.big circle { stroke-width: 1.2; }
.loader-tag { margin: 10px 0 0; font-size: 11px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); }
.wordmark { font-family: 'EB Garamond', Georgia, serif; font-style: italic; font-size: 30px; line-height: 1; letter-spacing: -0.01em; color: var(--ink); }
.crumb { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 14px; border-left: 1px solid var(--line-2); }
.crumb:empty { display: none; }

.search-wrap { position: relative; }
.search-wrap input {
  width: 100%; height: 40px; padding: 0 40px 0 38px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font: inherit; font-size: 14px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: border-color .2s, box-shadow .2s;
}
.search-wrap input::placeholder { color: var(--ink-3); }
.search-wrap input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-wrap input::-webkit-search-cancel-button { display: none; }
.search-ico { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search-wrap kbd { position: absolute; right: 10px; top: 9px; font: 500 12px 'Geist', sans-serif; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 7px; }
#results {
  position: absolute; top: 46px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto;
}
#results li { display: grid; grid-template-columns: 10px 1fr; column-gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
#results li i { width: 8px; height: 8px; border-radius: 50%; align-self: center; }
#results li .r-latin { grid-column: 2; font-family: 'EB Garamond', serif; font-style: italic; font-size: 14px; color: var(--ink-2); }
#results li.active, #results li:hover { background: var(--accent-soft); }
#results li.empty { display: block; color: var(--ink-2); cursor: default; }

.top-actions { justify-self: end; display: flex; gap: 10px; align-items: center; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: border-color .2s, background-color .2s;
}
.icon-btn:hover { border-color: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.small { width: 28px; height: 28px; border-radius: 8px; background: none; border-color: transparent; }
[data-theme="dark"] #theme .moon { display: none; }
[data-theme="light"] #theme .sun { display: none; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.seg button { padding: 6px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; font-size: 13px; transition: background-color .2s, color .2s; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg-small button { padding: 5px 9px; font-size: 12px; }

/* ---------------------------------------------------------------- panels */
.panel { background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(18px) saturate(1.1); -webkit-backdrop-filter: blur(18px) saturate(1.1); box-shadow: var(--shadow); }
.layers { position: fixed; z-index: 9; left: 16px; top: 72px; width: 252px; max-height: calc(100vh - 150px); overflow: auto; scrollbar-width: thin; border-radius: 16px; padding: 10px 10px 12px; transition: transform .4s; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 6px 8px; }
.panel-head h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.layers.folded .layers-body { display: none; }
.layers.folded #layers-fold svg { transform: rotate(-90deg); }
.layer { border-radius: 9px; }
.layer-toggle { width: 100%; display: grid; grid-template-columns: 12px 1fr 18px; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; text-align: left; transition: background-color .2s; }
.layer-toggle:hover { background: var(--accent-soft); }
.sw { width: 10px; height: 10px; border-radius: 3px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); transition: opacity .2s; }
.layer-name { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eye { width: 17px; height: 17px; color: var(--ink-3); }
.eye .slash { display: none; }
.layer.off .layer-name { color: var(--ink-3); }
.layer.off .sw { opacity: .3; }
.layer.off .eye .slash { display: block; }
.layer-op { width: calc(100% - 38px); margin: 0 0 6px 30px; display: block; }
.layer.off .layer-op { opacity: .4; }

.switch { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 9px 8px 2px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink); text-align: left; }
.switch-track { width: 30px; height: 18px; border-radius: 9px; background: var(--line-2); position: relative; flex: none; transition: background-color .25s; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); transition: transform .25s; }
.switch[aria-pressed="true"] .switch-track { background: var(--accent); }
.switch[aria-pressed="true"] .switch-thumb { transform: translateX(12px); background: var(--accent-ink); }

.btn { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-2); font-size: 13px; font-weight: 500; color: var(--ink); transition: background-color .2s, border-color .2s; }
.btn:hover { border-color: var(--accent); }
.btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { margin-top: 8px; width: 100%; padding: 6px 10px; }

/* range */
input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; height: 18px; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--line-2); border-radius: 2px; }
input[type="range"]::-moz-range-track { height: 2px; background: var(--line-2); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px; border-radius: 50%; background: var(--ink); border: 3px solid var(--panel-solid); box-shadow: 0 0 0 1px var(--line-2); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); border: 3px solid var(--panel-solid); }
input[type="range"]:focus-visible::-webkit-slider-thumb { background: var(--accent); }

/* ---------------------------------------------------------------- card */
.card {
  position: fixed; z-index: 9; right: 16px; top: 72px; width: 344px; max-height: calc(100vh - 168px); overflow: auto;
  border-radius: 18px; padding: 18px 20px 16px;
  opacity: 0; transform: translateX(16px); pointer-events: none; transition: opacity .35s, transform .45s cubic-bezier(.2,.8,.2,1);
}
.card.open { opacity: 1; transform: none; pointer-events: auto; }
.card-head { position: relative; padding-right: 30px; }
.card-sys { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.card-sys i { width: 8px; height: 8px; border-radius: 50%; }
.card-sys .side { margin-left: 2px; padding: 1px 7px; border-radius: 20px; border: 1px solid var(--line-2); font-size: 11.5px; }
.card-close { position: absolute; right: -6px; top: -6px; width: 30px; height: 30px; border-radius: 9px; background: none; border-color: transparent; }
.card-title { font-family: 'EB Garamond', Georgia, serif; font-weight: 500; font-size: 30px; line-height: 1.08; letter-spacing: -0.005em; margin: 10px 0 4px; text-wrap: balance; }
.card-latin { margin: 0; font-family: 'EB Garamond', Georgia, serif; font-style: italic; font-size: 17px; color: var(--ink-2); }
.card-alt { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }
.card-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 14px 0 0; font-size: 12.5px; color: var(--ink-3); }
.card-chain button { color: var(--ink-2); padding: 2px 0; border-bottom: 1px solid var(--line-2); }
.card-chain button:hover { color: var(--accent); border-color: var(--accent); }
.card-body { margin-top: 14px; }
.card-text { margin: 0; font-size: 14.5px; line-height: 1.58; color: var(--ink); max-width: 62ch; }
.card-text.is-en { color: var(--ink-2); font-size: 13.5px; }
.card-note { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); }
.card h4 { margin: 0 0 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.card h4 span { font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.facts { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.facts ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.facts li { position: relative; padding-left: 14px; font-size: 13.5px; line-height: 1.5; }
.facts li::before { content: ''; position: absolute; left: 0; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.ctx { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.ctx p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.card-parts { margin-top: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 4px 10px; border-radius: 20px; border: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-2); transition: border-color .2s, color .2s; }
.chips button:hover { border-color: var(--accent); color: var(--ink); }
.card-actions { display: flex; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.card-actions .btn { flex: 1; }

/* ---------------------------------------------------------------- dock */
.dock {
  position: fixed; z-index: 10; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow);
}
.dock .seg { background: none; border: 0; padding: 0; backdrop-filter: none; }
.dock .icon-btn { background: none; border-color: transparent; }
.explode { display: flex; align-items: center; gap: 10px; padding: 0 10px; font-size: 13px; color: var(--ink-2); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.explode input { width: 120px; }
.views { display: flex; gap: 2px; padding-left: 8px; border-left: 1px solid var(--line); }
.views button { padding: 6px 9px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2); }
.views button:hover { color: var(--ink); background: var(--accent-soft); }

.hint { position: fixed; z-index: 5; left: 50%; bottom: 74px; transform: translateX(-50%); margin: 0; font-size: 12px; color: var(--ink-2); white-space: nowrap; opacity: 0; transition: opacity .6s; pointer-events: none; }
.hint.on { opacity: 1; }
.credits { margin: 10px 0 0; padding: 9px 8px 0; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.45; color: var(--ink-3); }
.credits a { color: inherit; }
.pop-credits { margin-top: 12px; padding: 10px 0 0; }

.tip {
  position: fixed; z-index: 20; left: 0; top: 0; pointer-events: none; display: flex; flex-direction: column;
  padding: 6px 10px 7px; border-radius: 10px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: var(--shadow);
  opacity: 0; transition: opacity .15s;
}
.tip.on { opacity: 1; }
.tip-name { font-size: 13px; font-weight: 500; }
.tip-latin { font-family: 'EB Garamond', serif; font-style: italic; font-size: 13.5px; color: var(--ink-2); }

/* ---------------------------------------------------------------- loader */
#loader { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--bg); transition: opacity 1.2s ease .2s, visibility 0s 1.4s; }
body.ready #loader { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-inner { width: min(320px, 80vw); text-align: center; }
.wordmark.big { font-size: 64px; }
.loader-line { margin: 18px 0 14px; font-size: 13px; color: var(--ink-2); display: flex; justify-content: center; gap: 8px; }
#load-part { color: var(--ink-3); }
.load-track { height: 1px; background: var(--line-2); overflow: hidden; }
#load-bar { height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); transition: transform .4s; }
#load-error { color: #ff8f8f; font-size: 12px; min-height: 1em; }

body:not(.ready) .topbar, body:not(.ready) .layers, body:not(.ready) .dock { opacity: 0; }
.topbar, .layers, .dock { transition: opacity .8s .6s; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .views { display: none; }
}

.more summary { cursor: pointer; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); list-style: none; display: inline-block; padding: 3px 10px; border-radius: 20px; border: 1px dashed var(--line-2); }
.more summary::-webkit-details-marker { display: none; }
.more[open] summary { display: none; }
@media (max-width: 760px) {
  .topbar { grid-template-columns: auto 1fr auto; gap: 10px; padding: 10px 12px; }
  .crumb { display: none; }
  .wordmark, .logo .wordmark { font-size: 24px; }
  .logo-tag { display: none; }
  .brandmark { width: 28px; height: 28px; }
  .logo { gap: 8px; }
  .layers { top: 62px; left: 10px; width: 210px; }
  .layers:not(.folded) { max-height: 60vh; overflow: auto; }
  .card { left: 10px; right: 10px; top: auto; bottom: 84px; width: auto; max-height: 52vh; transform: translateY(16px); }
  .dock { bottom: 10px; gap: 4px; max-width: calc(100vw - 20px); overflow-x: auto; }
  .explode span { display: none; }
  .explode input { width: 80px; }
  .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01s !important; }
}

/* ---------------------------------------------------------------- organ view */
body.organ-mode .body-only, body:not(.organ-mode) .organ-only { display: none !important; }
.crumb button { color: var(--ink-2); border-bottom: 1px solid var(--line-2); padding: 0 0 1px; }
.crumb button:hover { color: var(--accent); border-color: var(--accent); }
.crumb span { margin: 0 8px; color: var(--ink-3); }
.crumb { color: var(--ink); }
.btn-back { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px 6px 6px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--ink); }
.btn-back svg, .tgl svg { width: 17px; height: 17px; }
.btn-back:hover { background: var(--accent-soft); }
.tgl { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 9px; font-size: 13px; color: var(--ink-2); }
.tgl:hover { color: var(--ink); }
.tgl[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.dock .cutaway { border-left: 0; padding-left: 0; }

.structure { width: 252px; }
.sgroup { border-radius: 10px; }
.sgroup + .sgroup { margin-top: 2px; }
.sgroup summary { display: grid; grid-template-columns: 1fr auto 26px; align-items: center; gap: 8px; padding: 6px 4px 6px 8px; border-radius: 9px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 500; }
.sgroup summary::-webkit-details-marker { display: none; }
.sgroup summary:hover { background: var(--accent-soft); }
.sg-count { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.sg-eye { width: 26px; height: 22px; display: grid; place-items: center; border-radius: 6px; }
.sgroup.off .sg-name { color: var(--ink-3); }
.sgroup.off .eye .slash { display: block; }
.srows { display: grid; padding: 2px 0 6px 6px; }
.srow { display: grid; grid-template-columns: 9px 1fr; gap: 9px; align-items: center; padding: 4px 8px; border-radius: 7px; text-align: left; font-size: 12.5px; color: var(--ink-2); }
.srow i { width: 8px; height: 8px; border-radius: 50%; }
.srow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow:hover { background: var(--accent-soft); color: var(--ink); }
.srow.on { color: var(--accent); font-weight: 500; }

.stats { margin: 16px 0 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.stats div { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.stats dt { font-size: 12.5px; color: var(--ink-3); }
.stats dd { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.card-back { display: inline-flex; align-items: center; gap: 2px; margin: -4px 0 8px -6px; padding: 3px 8px 3px 2px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2); }
.card-back svg { width: 16px; height: 16px; }
.card-back:hover { color: var(--accent); background: var(--accent-soft); }
.btn-organ { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 16px; background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.btn-organ svg { width: 17px; height: 17px; color: var(--accent); }
.btn-organ:hover { border-color: var(--accent); }
body.organ-loading #viewport { cursor: progress; }

/* quality popover */
.settings-wrap { position: relative; }
.pop { position: absolute; right: 0; top: 46px; width: 300px; padding: 14px; border-radius: 14px; z-index: 30; }
.pop h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; }
.qgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.qgrid button { padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); }
.qgrid button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pop-note { margin: 10px 0 0; font-size: 12px; line-height: 1.45; color: var(--ink-3); }
.tip-hint { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--accent); }

/* ---------------------------------------------------------------- layers panel v2 */
.panel-head h3 { display: flex; align-items: baseline; gap: 8px; }
.layer-count { font-weight: 400; font-size: 12px; color: var(--ink-3); }
.vchips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 4px 10px; }
.vchip { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 12px; color: var(--ink-2); transition: background-color .2s, color .2s, border-color .2s; }
.vchip:hover { color: var(--ink); border-color: var(--accent); }
.vchip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.lgroup { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 2px; }
.ochips { padding-top: 0; }
.ochip { display: inline-flex; align-items: center; gap: 6px; }
.ochip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; opacity: .6; }
.lg-head { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 6px 8px 4px; font-size: 11.5px; color: var(--ink-3); text-align: left; }
.lg-toggle:hover { color: var(--ink); }
.lg-toggle .chev { width: 16px; height: 16px; transition: transform .25s; }
.lg-toggle.open .chev { transform: rotate(180deg); }
.layer { display: grid; grid-template-columns: minmax(0, 1fr) 28px; align-items: center; column-gap: 2px; }
.layer .layer-op { grid-column: 1 / -1; }
.layer.big .layer-name { font-size: 13.5px; font-weight: 500; }
.layer.partial .sw { opacity: .6; }
.layer.solo .layer-name { color: var(--accent); }
.layer-solo { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--ink-3); opacity: .5; transition: opacity .2s, background-color .2s, color .2s; }
.layer:hover .layer-solo, .layer-solo:focus-visible, .layer-solo.on { opacity: 1; }
.layer-solo:hover { background: var(--accent-soft); color: var(--ink); }
.layer-solo.on { color: var(--accent); background: var(--accent-soft); }
.layer-solo svg { width: 16px; height: 16px; }
@media (hover: none) { .layer-solo { opacity: .85; } }
.lfoot { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 4px; }
.lfoot .switch { border-top: 0; margin-top: 0; padding: 7px 8px; }
.switch.dim { opacity: .55; }
.btn.small.ghost { border-color: transparent; color: var(--ink-2); margin-top: 2px; }

/* ---------------------------------------------------------------- tours menu */
.tours-wrap { position: relative; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 11px; border-radius: 11px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; transition: border-color .2s, background-color .2s, color .2s; }
.pill:hover { border-color: var(--accent); }
.pill svg { width: 18px; height: 18px; color: var(--accent); }
.pill .fillp { fill: currentColor; stroke: none; }
.pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill[aria-pressed="true"] svg { color: currentColor; }
#fs-btn .fs-out, body.fullscreen #fs-btn .fs-in { display: none; }
body.fullscreen #fs-btn .fs-out { display: inline; }
.tours-pop { width: 360px; padding: 14px 14px 10px; }
.tour-list { display: grid; gap: 2px; margin: 2px -6px 0; }
.tour-item { display: grid; grid-template-columns: 30px 1fr; column-gap: 6px; padding: 10px; border-radius: 11px; text-align: left; transition: background-color .2s; }
.tour-item:hover, .tour-item:focus-visible { background: var(--accent-soft); }
.ti-num { grid-row: 1 / 3; font: italic 500 17px/1.2 'EB Garamond', Georgia, serif; color: var(--accent); }
.ti-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ti-title { font-family: 'EB Garamond', Georgia, serif; font-size: 21px; line-height: 1.1; color: var(--ink); }
.ti-blurb { font-size: 12.5px; line-height: 1.4; color: var(--ink-2); }
.ti-meta { grid-column: 2; margin-top: 5px; font-size: 11.5px; color: var(--ink-3); }
.tour-intro { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 6px; padding: 10px 4px 4px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.tour-intro:hover { color: var(--accent); }
.tour-intro svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- cinema: tours and the opening own the screen */
body.touring .layers, body.touring .dock, body.touring .card, body.touring .hint, body.touring .tip, body.touring .search-wrap,
body.intro .topbar, body.intro .layers, body.intro .dock, body.intro .card, body.intro .hint, body.intro .tip,
body.intro .atlas-label, body.intro .leaders { opacity: 0 !important; pointer-events: none !important; }
body.touring .layers, body.touring .dock, body.touring .search-wrap { transition: opacity .45s 0s; }
.cine-scrim { position: fixed; left: 0; right: 0; bottom: 0; height: 46vh; z-index: 3; pointer-events: none; opacity: 0; transition: opacity .8s;
  background: linear-gradient(to top, color-mix(in srgb, var(--bg) 90%, transparent) 0%, color-mix(in srgb, var(--bg) 55%, transparent) 38%, transparent 100%); }
body.touring .cine-scrim { opacity: 1; }

.tour-ui { position: fixed; z-index: 11; left: 36px; bottom: 26px; width: min(580px, calc(100vw - 72px)); --halo: color-mix(in srgb, var(--bg) 80%, transparent); }
.tour-ui[hidden] { display: none; }
.tour-cap { transition: opacity .24s, transform .3s cubic-bezier(.2,.8,.2,1); }
.tour-cap.swap { opacity: 0; transform: translateY(8px); }
.tour-kicker { display: flex; gap: 12px; margin: 0 0 8px; font-size: 11.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
#tour-count { color: var(--ink-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.tour-title { margin: 0; font-family: 'EB Garamond', Georgia, serif; font-weight: 500; font-size: 46px; line-height: 1.02; letter-spacing: -0.012em; text-wrap: balance; text-shadow: 0 0 18px var(--halo); }
.tour-text { margin: 10px 0 0; max-width: 54ch; font-size: 16px; line-height: 1.55; color: var(--ink); text-wrap: pretty; text-shadow: 0 0 4px var(--halo), 0 0 14px var(--halo); }
.tour-bar { margin-top: 18px; }
.tour-prog { display: flex; gap: 4px; }
.tp-seg { position: relative; flex: 1; height: 14px; }
.tp-seg::after, .tp-seg i { content: ''; position: absolute; left: 0; right: 0; top: 6px; height: 2px; border-radius: 2px; }
.tp-seg::after { background: var(--line-2); transition: background-color .2s; }
.tp-seg:hover::after { background: var(--ink-3); }
.tp-seg i { z-index: 1; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
.tour-ctl { display: flex; align-items: center; gap: 2px; margin-top: 6px; }
.tc-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--ink); transition: background-color .2s, color .2s; }
.tc-btn:hover { background: var(--accent-soft); }
.tc-btn svg { width: 18px; height: 18px; }
.tc-play .i-play { display: none; }
.tc-play .i-play path { fill: currentColor; stroke-width: 1.2; }
.tc-play.paused { background: var(--accent); color: var(--accent-ink); }
.tc-play.paused .i-play { display: block; }
.tc-play.paused .i-pause { display: none; }
.tour-hint { flex: 1; min-width: 0; margin: 0 10px; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-exit { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px 7px 13px; border-radius: 10px; border: 1px solid var(--line-2); font-size: 13px; font-weight: 500; color: var(--ink); transition: border-color .2s, background-color .2s; }
.tc-exit:hover { border-color: var(--accent); }
.tc-exit svg { width: 15px; height: 15px; }

.intro-title { position: fixed; z-index: 12; left: 8vw; top: 50%; text-align: left; pointer-events: none; opacity: 0; transform: translateY(calc(-50% + 14px)); transition: opacity 1.3s ease, transform 2.6s cubic-bezier(.2,.8,.2,1); }
.intro-title.on { opacity: 1; transform: translateY(-50%); }
.wordmark.huge { font-size: clamp(64px, 10vw, 132px); line-height: .95; }
.intro-tag { margin: 10px 0 0; font-size: 12.5px; font-weight: 500; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-2); }
.intro-skip { position: fixed; z-index: 60; right: 24px; bottom: 22px; display: none; align-items: center; gap: 8px; padding: 8px 12px 8px 15px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16); background: rgba(8,18,16,.45); color: #e3ece8; font-size: 13px; font-weight: 500; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; animation: soma-fadein .8s 1.6s forwards; transition: border-color .2s; }
body.intro .intro-skip { display: inline-flex; }
.intro-skip:hover { border-color: rgba(255,255,255,.42); }
.intro-skip svg { width: 15px; height: 15px; }
@keyframes soma-fadein { to { opacity: 1; } }

@media (max-width: 1180px) { .pill span { display: none; } .pill { padding: 0; width: 38px; justify-content: center; } }
@media (max-width: 760px) {
  .tours-pop { position: fixed; left: 10px; right: 10px; top: 58px; width: auto; }
  .tour-ui { left: 14px; right: 14px; bottom: 12px; width: auto; }
  .tour-title { font-size: 31px; }
  .tour-text { font-size: 14.5px; }
  .tour-hint { display: none; }
  .tour-ctl { justify-content: space-between; }
  .cine-scrim { height: 58vh; }
  .intro-title { left: 0; right: 0; top: auto; bottom: 11vh; text-align: center; transform: translateY(14px); }
  .intro-title.on { transform: none; }
}
@media (max-width: 760px) {
  .top-actions { gap: 6px; }
  .top-actions .icon-btn, .pill { width: 34px; height: 34px; }
  .seg-small button { padding: 4px 7px; }
}

/* ---------------------------------------------------------------- tours, lessons, find it menus */
.learn-wrap { display: flex; gap: 8px; }
.pill[aria-expanded="true"]:not([aria-pressed="true"]) { border-color: var(--accent); background: var(--accent-soft); }
.learn-pop { position: fixed; top: 62px; right: 18px; width: min(1000px, calc(100vw - 36px)); max-height: calc(100vh - 74px); overflow: auto; padding: 14px 14px 12px; scrollbar-width: thin; }
.learn-pop.lp-game { width: min(420px, calc(100vw - 36px)); }
.hub-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; margin: 0 6px 10px; }
.hub-head h3 { margin: 0; font: 500 26px/1.1 'EB Garamond', Georgia, serif; }
.hub-head .hub-intro { flex: 1; min-width: 200px; margin: 0; }
.hub-head .tour-intro { width: auto; margin: 0; padding: 4px 2px; border: 0; }
.learn-pop .tour-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; }
.learn-pop .tour-item { align-content: start; padding: 10px 12px 11px 10px; border: 1px solid var(--line); }
.learn-pop .tour-item:hover, .learn-pop .tour-item:focus-visible { border-color: var(--accent); }
.learn-pop .ti-title { font-size: 20px; }
@media (max-width: 1000px) { .learn-pop .tour-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .learn-pop .tour-list { grid-template-columns: 1fr; } }
.hub-intro { margin: 2px 4px 6px; font-size: 12.5px; line-height: 1.45; color: var(--ink-3); }
.hub-prog { color: var(--accent); font-weight: 500; white-space: nowrap; }
.tour-item.done .ti-num { color: var(--accent); }
.tour-item .ti-num svg { width: 18px; height: 18px; stroke-width: 2; }
.ti-meta b { font-weight: 500; color: var(--accent); }
.hub-levels { display: grid; gap: 6px; margin: 4px 0 4px; }
.hub-levels button { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); text-align: left; transition: border-color .2s, background-color .2s; }
.hub-levels button:hover { border-color: var(--accent); }
.hub-levels button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.hl-name { font-family: 'EB Garamond', Georgia, serif; font-size: 20px; line-height: 1.1; }
.hl-desc { grid-column: 1; font-size: 12.5px; color: var(--ink-2); }
.hl-best { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.learn-pop .switch { border-top: 0; margin-top: 4px; padding: 8px 6px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.ghost { border-color: var(--line-2); }
.hub-play { width: 100%; margin-top: 6px; padding: 11px 14px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; }
.hub-play svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- living body: vital signs */
.vitals { position: fixed; z-index: 10; left: 50%; bottom: 78px; transform: translate(-50%, 8px); display: none; align-items: center; gap: 12px; padding: 6px 6px 6px 14px; border-radius: 14px; opacity: 0; transition: opacity .35s, transform .35s; }
.vitals.on { display: flex; opacity: 1; transform: translate(-50%, 0); }
.vt-num { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.vt-num b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.vt-num span { font-size: 11.5px; color: var(--ink-3); }
.vt-heart { width: 15px; height: 15px; align-self: center; color: #ff6b5e; fill: currentColor; stroke: none; transition: transform .06s; }
.vt-lung { width: 16px; height: 16px; align-self: center; color: #7ac4d6; }
.vt-ecg { width: 150px; height: 34px; display: block; }
.vt-rate button { min-width: 52px; }
.vitals .icon-btn.small svg { width: 15px; height: 15px; }
body.living .hint { bottom: 136px; }
body.touring .vitals.on { left: auto; right: 24px; bottom: 26px; transform: none; }
body.game .vitals.on, body.lesson .vitals.on { bottom: 18px; }
body.lesson .vitals.on { left: calc((100vw - 400px) / 2); }
body.intro .vitals { display: none !important; }
#life-toggle svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- lessons */
body.lesson .layers, body.lesson .dock, body.lesson .card, body.lesson .search-wrap,
body.game .layers, body.game .dock, body.game .card, body.game .search-wrap, body.game .tip { opacity: 0 !important; pointer-events: none !important; }
body.lesson .layers, body.lesson .dock, body.game .layers, body.game .dock { transition: opacity .35s 0s; }
.lesson-panel { position: fixed; z-index: 11; right: 16px; top: 72px; width: 372px; max-height: calc(100vh - 92px); overflow: auto; display: flex; flex-direction: column; border-radius: 18px; padding: 16px 20px 14px; }
.lesson-panel[hidden], .game-hud[hidden] { display: none; }
.lesson-panel.in .ls-body { animation: soma-rise .45s cubic-bezier(.2,.8,.2,1); }
@keyframes soma-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ls-head, .gm-head { position: relative; padding-right: 30px; }
.ls-kicker, .gm-kicker { margin: 0; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.ls-dots { display: flex; gap: 5px; margin: 12px 0 4px; }
.ls-dots i { flex: 1; height: 3px; border-radius: 2px; background: var(--line-2); transition: background-color .3s; }
.ls-dots i.past { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.ls-dots i.now { background: var(--accent); }
.ls-dots i.q { flex: 0 0 18px; }
.ls-body { flex: 1; }
.ls-title { margin: 14px 0 8px; font-family: 'EB Garamond', Georgia, serif; font-weight: 500; font-size: 32px; line-height: 1.05; letter-spacing: -0.008em; text-wrap: balance; }
.ls-title.q { font-size: 25px; line-height: 1.15; }
.ls-sub { margin: 14px 0 0; font-size: 12.5px; color: var(--ink-3); }
.ls-text { margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink); text-wrap: pretty; }
.ls-task { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: start; margin-top: 16px; padding: 12px 12px 12px 10px; border-radius: 14px; border: 1px solid var(--accent); background: var(--accent-soft); }
.ls-task.done, .ls-task.shown { border-color: color-mix(in srgb, #4fbf8a 70%, transparent); background: color-mix(in srgb, #4fbf8a 13%, transparent); }
.lt-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.lt-icon i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: soma-ping 1.6s ease-in-out infinite; }
@keyframes soma-ping { 50% { transform: scale(1.6); opacity: .5; } }
.ls-task.done .lt-icon, .ls-task.shown .lt-icon { background: #4fbf8a; color: #08231a; }
.lt-icon svg { width: 16px; height: 16px; stroke-width: 2.4; }
.lt-label { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.lt-text { margin: 2px 0 0; font-size: 14.5px; font-weight: 500; color: var(--ink); }
.lt-msg { margin: 6px 0 0; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.ls-task.wrong .lt-msg { color: #ff9b8f; }
[data-theme="light"] .ls-task.wrong .lt-msg { color: #b3372b; }
.ls-task.done .lt-msg, .ls-task.shown .lt-msg { color: var(--ink); font-weight: 500; }
.lt-show { align-self: center; padding: 6px 10px; border-radius: 9px; font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--line-2); }
.lt-show:hover { color: var(--ink); border-color: var(--accent); }
.ls-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.ls-foot.wrap { flex-wrap: wrap; }
.ls-foot .btn { padding: 9px 14px; }
.ls-count { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ls-opts { display: grid; gap: 8px; margin-top: 14px; }
.ls-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); text-align: left; font-size: 14.5px; transition: border-color .2s, background-color .2s, opacity .2s; }
.ls-opt:hover:not([aria-disabled]) { border-color: var(--accent); background: var(--accent-soft); }
.ls-opt[aria-disabled] { cursor: default; }
.ls-opt svg { width: 18px; height: 18px; stroke-width: 2.2; flex: none; }
.ls-opt.ok { border-color: #4fbf8a; background: color-mix(in srgb, #4fbf8a 14%, transparent); }
.ls-opt.ok svg { color: #4fbf8a; }
.ls-opt.bad { border-color: #ff8a7e; background: color-mix(in srgb, #ff6b5e 12%, transparent); }
.ls-opt.bad svg { color: #ff8a7e; }
.ls-opt.dim { opacity: .5; }
.ls-why { margin: 14px 0 0; font-size: 14px; line-height: 1.55; color: var(--ink); }
.ls-why b { font-weight: 600; }
.ls-why.ok b { color: #4fbf8a; } .ls-why.bad b { color: #ff8a7e; }
.ls-done { text-align: left; }
.ls-score { margin: 18px 0 0; font-family: 'EB Garamond', Georgia, serif; font-size: 28px; color: var(--ink-2); }
.ls-score span { font-size: 72px; line-height: 1; color: var(--accent); }

/* ---------------------------------------------------------------- find-it game */
.game-hud { position: fixed; z-index: 11; left: 16px; top: 72px; width: 300px; max-height: calc(100vh - 92px); overflow: auto; border-radius: 18px; padding: 16px 18px 14px; }
.gm-prog { display: flex; gap: 4px; margin: 12px 0 0; }
.gm-prog i { flex: 1; height: 3px; border-radius: 2px; background: var(--line-2); }
.gm-prog i.now { background: var(--accent); }
.gm-prog i.won { background: #4fbf8a; }
.gm-prog i.lost { background: #ff8a7e; }
.gm-ask { display: flex; justify-content: space-between; margin: 16px 0 0; font-size: 12.5px; color: var(--ink-2); }
.gm-ask span { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.gm-name { margin: 4px 0 0; font-family: 'EB Garamond', Georgia, serif; font-weight: 500; font-size: 36px; line-height: 1.04; letter-spacing: -0.01em; text-wrap: balance; }
.gm-latin { margin: 3px 0 0; min-height: 1.3em; font-family: 'EB Garamond', Georgia, serif; font-style: italic; font-size: 18px; color: var(--ink-2); }
.gm-timer { height: 4px; margin: 14px 0 0; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.gm-timer i { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transition: background-color .3s; }
.gm-timer.low i { background: #ff8a7e; }
.gm-timer.stop i { opacity: .35; }
.gm-stats { display: flex; gap: 16px; margin: 12px 0 0; font-size: 12.5px; color: var(--ink-3); }
.gm-stats b { margin-left: 4px; font-size: 15px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.gm-hinted { margin-left: auto; color: var(--accent); }
.gm-msg { min-height: 2.9em; margin: 12px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.gm-msg.ok { color: #4fbf8a; font-weight: 600; }
.gm-msg.bad { color: #ff9b8f; }
[data-theme="light"] .gm-msg.ok { color: #1f8a57; }
[data-theme="light"] .gm-msg.bad { color: #b3372b; }
.gm-actions { display: flex; gap: 8px; margin-top: 8px; }
.gm-actions .btn { flex: 1; padding: 9px 10px; }
.gm-latin-sw { margin-top: 12px; }
.gm-float { position: fixed; z-index: 40; pointer-events: none; transform: translate(-50%, -50%); font-family: 'EB Garamond', Georgia, serif; font-size: 34px; font-weight: 500; color: #4fbf8a;
  text-shadow: 0 0 12px color-mix(in srgb, var(--bg) 80%, transparent); animation: soma-float 1.3s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes soma-float { from { opacity: 0; transform: translate(-50%, -30%) scale(.8); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1); } to { opacity: 0; transform: translate(-50%, -190%); } }
.gm-end { margin-top: 10px; }
.gm-final { margin: 8px 0 0; font-family: 'EB Garamond', Georgia, serif; font-size: 22px; color: var(--ink-2); }
.gm-final span { margin-right: 8px; font-size: 64px; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.gm-sum { margin: 4px 0 12px; font-size: 13.5px; color: var(--ink-2); }
.gm-sum b { color: var(--accent); }
.gm-list { margin: 0; padding: 0; list-style: none; display: grid; border-top: 1px solid var(--line); }
.gm-list li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.gl-mark { font-weight: 700; }
.gm-list li.won .gl-mark { color: #4fbf8a; } .gm-list li.lost .gl-mark { color: #ff8a7e; }
.gl-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gl-name i { font-family: 'EB Garamond', Georgia, serif; font-size: 13.5px; color: var(--ink-3); }
.gl-pts { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.gm-actions.end { margin-top: 14px; }

@media (max-width: 760px) {
  .learn-pop, .learn-pop.lp-game { position: fixed; left: 10px; right: 10px; top: 58px; width: auto; max-height: calc(100vh - 70px); overflow: auto; }
  .learn-wrap { gap: 6px; }
  .lesson-panel { left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; max-height: 56vh; padding: 14px 16px 12px; }
  .ls-title { font-size: 26px; margin-top: 10px; }
  .ls-text { font-size: 14px; }
  .game-hud { left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; max-height: 50vh; padding: 12px 14px; }
  .gm-name { font-size: 28px; }
  .gm-msg { min-height: 0; }
  .vitals { left: 10px; right: 10px; bottom: 70px; transform: none; gap: 8px; padding: 6px 6px 6px 10px; flex-wrap: wrap; justify-content: space-between; }
  .vitals.on { transform: none; }
  .vt-ecg { width: 90px; }
  .vt-num span { display: none; }
  body.lesson .vitals.on, body.game .vitals.on { display: none; }
}
/* tours script the pace, so the vitals bar stays compact beside the captions */
body.touring .vt-rate, body.touring #vitals-off { display: none; }

/* ---------------------------------------------------------------- design credit */
.design-credit { position: fixed; z-index: 8; right: 14px; bottom: 7px; font: 600 10px/1 'Geist', ui-sans-serif, sans-serif; letter-spacing: .14em; color: var(--ink-3); text-decoration: none; opacity: .85; transition: color .2s, opacity .6s; }
.design-credit:hover, .design-credit:focus-visible { color: var(--accent); opacity: 1; }
body:not(.ready) .design-credit { opacity: 0; }

/* ---------------------------------------------------------------- body slicer */
.slicer { position: fixed; z-index: 10; left: 50%; bottom: 78px; transform: translateX(-50%); display: none; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 6px 6px 6px 6px; border-radius: 14px; max-width: calc(100vw - 24px); }
.slicer.on { display: flex; }
body.organ-mode .slicer, body.touring .slicer, body.lesson .slicer, body.game .slicer, body.intro .slicer { display: none !important; }
#slice-pos { width: 210px; }
.slicer .icon-btn.small svg { width: 16px; height: 16px; }
#slice-flip[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.slice-hint { flex-basis: 100%; margin: 0 6px 2px; font-size: 11.5px; color: var(--ink-3); }
.cap-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--line); }
.cap-seg button { padding: 5px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; transition: background-color .2s, color .2s; }
.cap-seg button:hover { color: var(--ink); }
.cap-seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
body.slicing .vitals.on { bottom: 164px; }
body.slicing .hint { bottom: 168px; }
body.slicing.living .hint { bottom: 224px; }

/* ---------------------------------------------------------------- capture */
.capture-pop { width: 340px; padding: 14px; }
.capture-pop h3 { margin-bottom: 10px; }
.cap-label { display: flex; justify-content: space-between; margin: 12px 2px 6px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.cap-dim { font-weight: 400; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.capture-pop .cap-seg { display: flex; }
.capture-pop .cap-seg button { flex: 1; }
.cap-opts { display: grid; grid-template-columns: 1fr 1fr; margin-top: 8px; }
.cap-opts .switch { border-top: 0; margin-top: 0; padding: 7px 4px; font-size: 12.5px; }
.cap-go { width: 100%; margin-top: 10px; padding: 10px 12px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; }
.cap-go svg { width: 18px; height: 18px; }
.cap-tour { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-top: 8px; }
.cap-tour select { min-width: 0; height: 36px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-solid); color: var(--ink); font: inherit; font-size: 13px; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #ff4d4d; box-shadow: 0 0 0 3px rgba(255, 77, 77, .25); }
.rec-hud { position: fixed; z-index: 70; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 999px;
  background: rgba(10, 16, 14, .78); color: #f2f5f4; font: 500 13px/1 'Geist', sans-serif; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 30px -14px rgba(0,0,0,.6); }
.rec-hud[hidden] { display: none; }
.rec-hud .rec-dot { animation: soma-blink 1.2s ease-in-out infinite; }
@keyframes soma-blink { 50% { opacity: .25; } }
.rec-label { letter-spacing: .12em; font-weight: 600; }
#rec-time { min-width: 3.2em; font-variant-numeric: tabular-nums; color: #c9d4d0; }
#rec-stop { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 9px; border-radius: 999px; background: #ff4d4d; color: #fff; font-weight: 600; font-size: 12.5px; }
#rec-stop svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }
#capture-btn.rec { color: #ff4d4d; border-color: rgba(255, 77, 77, .5); }
#viewport #rec-view { display: none; position: absolute; z-index: 1; pointer-events: none; }
body.recording #viewport #rec-view { display: block; }
body.recording #viewport { background: #000; }
body.recording #overlay, body.recording .tour-cap, body.recording .cine-scrim, body.recording #intro-title, body.recording .hint { visibility: hidden; }
.cap-toast { position: fixed; z-index: 70; left: 50%; top: 64px; transform: translate(-50%, -6px); padding: 8px 14px; border-radius: 10px; background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  font-size: 13px; color: var(--ink); opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; }
.cap-toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .design-credit { right: 8px; bottom: 3px; font-size: 9px; }
  .dock { bottom: 18px; }
  .slicer { bottom: 76px; }
  #slice-pos { width: 130px; }
  .capture-pop { position: fixed; left: 10px; right: 10px; top: 58px; width: auto; }
}

/* ---------------------------------------------------------------- phones: the top bar takes two rows */
@media (max-width: 620px) {
  .topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; padding: 10px 12px 8px; }
  .top-actions { display: contents; }
  .brand { order: 1; margin-right: auto; }
  .learn-wrap { order: 2; gap: 6px; }
  .topbar .seg-small { order: 3; }
  .search-wrap { order: 4; flex: 1 1 calc(100% - 160px); min-width: 0; }
  .topbar .settings-wrap, #theme, #fs-btn { order: 5; }
  .top-actions .icon-btn, .pill { width: 32px; height: 32px; }
  .search-wrap input { height: 36px; }
  .search-ico { top: 9px; }
  .search-wrap kbd { display: none; }
  .layers, .structure { top: 104px; }
  .learn-pop, .learn-pop.lp-game, .capture-pop, .tours-pop { top: 100px; max-height: calc(100vh - 190px); }
  .learn-pop .tour-item { padding: 8px 10px; }
  .learn-pop .ti-title { font-size: 18px; }
  .cap-toast { top: 106px; }
}

/* ---------------------------------------------------------------- powers of ten */
.zoom-wrap { position: relative; display: inline-flex; }
.zoom-pop { position: absolute; left: 50%; right: auto; top: auto; bottom: 48px; transform: translateX(-50%); width: 360px; padding: 14px 14px 10px; background: var(--panel-solid); }
.zoom-pop h3 { margin: 0 4px 4px; font: 500 24px/1.1 'EB Garamond', Georgia, serif; }
.zoom-pop .tour-list { margin-top: 6px; }
body.zoom-mode .layers, body.zoom-mode .dock, body.zoom-mode .card, body.zoom-mode .hint, body.zoom-mode .tip, body.zoom-mode .search-wrap,
body.zoom-mode #structure, body.zoom-mode .vitals, body.zoom-mode .slicer, body.zoom-mode #overlay { opacity: 0 !important; pointer-events: none !important; transition-delay: 0s !important; transition-duration: .3s !important; }
.mz-ui[hidden] { display: none; }
.mz-ruler { position: fixed; z-index: 12; left: 18px; top: 82px; bottom: 96px; width: 172px; padding: 0; border-radius: 16px; background: transparent; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.mzr-track { position: absolute; left: 14px; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.mzr-tick { position: absolute; left: 10px; height: 0; }
.mzr-tick::before { content: ''; position: absolute; left: 0; top: 0; width: 9px; height: 1px; background: var(--ink-3); }
.mzr-tick span { position: absolute; left: 16px; top: -7px; font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: .02em; }
.mzr-level { position: absolute; left: 9px; transform: translateY(-50%); display: flex; align-items: center; gap: 8px; padding: 2px 6px 2px 0; border-radius: 8px; font-size: 12px; color: var(--ink-2); text-align: left; white-space: nowrap; }
.mzr-level i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--ink-2); background: var(--bg); flex: none; transition: background-color .25s, border-color .25s, transform .25s; }
.mzr-level span { padding-left: 66px; opacity: .78; transition: opacity .25s, color .25s; }
.mzr-level:hover span, .mzr-level.on span { opacity: 1; color: var(--ink); }
.mzr-level.on i { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
.mzr-level:hover i { border-color: var(--accent); }
.mzr-now { position: absolute; left: 0; width: 30px; height: 0; pointer-events: none; }
.mzr-now::before { content: ''; position: absolute; left: 2px; top: -1px; width: 26px; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.mzr-now span { position: absolute; left: 34px; top: -11px; padding: 3px 8px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mz-cap { position: fixed; z-index: 12; left: 206px; bottom: 100px; max-width: min(470px, calc(100vw - 230px)); pointer-events: none; opacity: 0; transform: translateY(8px); transition: opacity .5s, transform .5s; }
.mz-cap.on { opacity: 1; transform: none; }
.mz-kick { margin: 0 0 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.mz-title { margin: 0; font: 500 44px/1.02 'EB Garamond', Georgia, serif; color: var(--ink); text-shadow: 0 1px 16px var(--bg); }
.mz-size { margin: 6px 0 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.mz-text { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink); text-shadow: 0 1px 10px var(--bg), 0 0 2px var(--bg); }
.mz-bar { position: fixed; z-index: 12; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 14px; max-width: calc(100vw - 24px); }
.mz-journeys { display: flex; gap: 6px; }
.mz-journeys .vchip { font-size: 12.5px; padding: 5px 11px; }
.mz-sep { width: 1px; height: 22px; background: var(--line-2); }
.mz-ctl { display: flex; align-items: center; gap: 6px; }
.mz-ctl .icon-btn { width: 34px; height: 34px; background: none; border-color: transparent; }
.mz-play { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px 7px 11px; }
.mz-play svg { width: 16px; height: 16px; }
.mz-hint { position: fixed; z-index: 12; left: 50%; bottom: 72px; transform: translateX(-50%); margin: 0; font-size: 12px; color: var(--ink-3); white-space: nowrap; pointer-events: none; transition: opacity .8s; }
.mz-hint.off { opacity: 0; }
.mz-labels { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
.mz-label { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity .35s; }
.mz-label.on { opacity: 1; }
.mz-label i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--ink); }
.mzl-line { position: absolute; left: 5px; top: 0; width: 46px; height: 1px; background: var(--leader); }
.mzl-text { position: absolute; left: 56px; top: -10px; display: flex; flex-direction: column; white-space: nowrap; }
.mzl-text b { font-size: 13.5px; font-weight: 600; color: var(--ink); text-shadow: 0 0 6px var(--bg), 0 0 2px var(--bg); }
.mzl-text em { font-family: 'EB Garamond', Georgia, serif; font-size: 13.5px; color: var(--ink-2); text-shadow: 0 0 6px var(--bg); }
.mz-label.left .mzl-line { left: auto; right: 5px; }
.mz-label.left .mzl-text { left: auto; right: 56px; align-items: flex-end; text-align: right; }
@media (max-width: 760px) {
  .mz-ruler { width: 70px; top: 112px; bottom: 210px; }
  .mzr-level span { display: none; }
  .mz-cap { left: 14px; right: 14px; bottom: 76px; max-width: none; }
  .mz-title { font-size: 30px; }
  .mz-text { font-size: 13.5px; }
  .mz-hint { display: none; }
  .mz-journeys .vchip { padding: 4px 8px; font-size: 11.5px; }
  .zoom-pop { position: fixed; left: 10px; right: 10px; bottom: 74px; width: auto; transform: none; }
}
@media (max-width: 620px) {
  .mz-journeys, .mz-bar .mz-sep { display: none; }      /* phones: switch journeys from the Scale menu */
  .mz-ruler { top: 104px; }
}
