:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  --bg: #101016;
  --panel: #15151e;
  --panel-2: #1a1a25;
  --line: #2b2a38;
  --text: #f4f2fa;
  --muted: #a5a3b7;
  --quiet: #858298;
  --accent: #b79cff;
  --accent-strong: #aa89ff;
  --accent-ink: #201733;
  --radius: 17px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { border: 0; color: inherit; background: none; }
button:disabled, select:disabled { cursor: not-allowed; opacity: .46; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); }
[hidden] { display: none !important; }
svg { display: block; width: 19px; height: 19px; flex-shrink: 0; }
.topbar {
  height: 69px; display: flex; align-items: center; gap: 23px; padding: 0 clamp(22px, 3.25vw, 58px);
  border-bottom: 1px solid #252430; background: #14141c;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 21px; font-weight: 750; letter-spacing: -.05em; text-decoration: none; }
.brand-period { color: var(--accent); }
.brand-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; color: #1a1328; background: var(--accent-strong); box-shadow: 0 3px 15px #9a76f12b; }
.brand-icon svg { width: 24px; height: 24px; }
.top-divider { height: 25px; width: 1px; background: var(--line); }
.brand-subtitle { font-size: 13px; color: var(--muted); white-space: nowrap; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.top-search, .top-plain { display: flex; align-items: center; gap: 9px; border-radius: 8px; min-height: 38px; font-size: 13px; color: var(--muted); }
.top-search { width: clamp(204px, 20vw, 285px); border: 1px solid var(--line); background: #1c1b26; padding: 0 10px 0 12px; text-align: left; white-space: nowrap; }
.top-search:hover, .top-plain:hover, .icon-btn:hover, .footer-btn:hover { color: var(--text); background: #262431; }
.top-search kbd { margin-left: auto; white-space: nowrap; }
kbd { font: 11px ui-monospace, monospace; color: var(--muted); border: 1px solid #3b384a; background: #272534; padding: 2px 5px; border-radius: 4px; }
.top-plain { padding: 0 9px; }
.top-plain svg, .top-search svg { width: 16px; height: 16px; }
.icon-btn { display: grid; width: 36px; height: 36px; place-items: center; padding: 0; border-radius: 8px; color: var(--muted); }
.icon-btn[aria-pressed="true"] { color: var(--accent); background: #312643; }
.help-btn { border: 1px solid var(--line); }
.workspace { margin: 0 auto; max-width: 1760px; padding: 29px clamp(22px, 3.25vw, 58px) 16px; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 0 0 23px; }
.section-label { margin-bottom: 8px; display: flex; align-items: center; gap: 7px; color: var(--accent); font-size: 12px; font-weight: 650; }
.section-label svg { width: 14px; height: 14px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(31px, 3.25vw, 49px); line-height: 1.07; letter-spacing: -.051em; font-weight: 745; }
.page-intro p { margin-top: 9px; font-size: 14px; color: var(--muted); line-height: 1.4; }
.atlas-stats { display: flex; padding-bottom: 1px; align-items: stretch; flex-shrink: 0; }
.atlas-stats > div { padding: 0 20px; border-left: 1px solid var(--line); }
.atlas-stats > div:last-child { padding-right: 0; }
.atlas-stats strong { display: block; font-size: 25px; letter-spacing: -.04em; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.atlas-stats span { color: var(--muted); font-size: 11px; margin-top: 6px; display: block; }
.atlas { display: grid; grid-template-columns: clamp(192px, 17.3vw, 256px) minmax(0, 1fr) clamp(265px, 24vw, 350px); gap: 14px; height: clamp(552px, calc(100dvh - 243px), 970px); }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.systems { display: flex; flex-direction: column; overflow: auto; scrollbar-color: #373444 transparent; scrollbar-width: thin; }
.side-heading { display: flex; align-items: center; gap: 9px; color: var(--quiet); }
.side-heading h2 { color: #dedbe9; font-size: 13px; font-weight: 650; letter-spacing: .005em; }
.side-heading svg { width: 16px; height: 16px; }
.systems > .side-heading { padding: 16px 15px 13px; }
.system-list { padding: 0 9px; display: grid; gap: 4px; }
.system-button { display: grid; grid-template-columns: 29px minmax(0, 1fr) 11px; align-items: center; gap: 7px; min-height: 36px; text-align: left; width: 100%; padding: 2px 6px; border: 1px solid transparent; border-radius: 9px; color: #c1bed1; font-size: 12px; font-weight: 580; line-height: 1.18; }
.system-button:hover { border-color: #343142; background: #201e2a; color: var(--text); }
.system-button[aria-pressed="true"] { border-color: #56406e; background: #282036; color: #f2eaff; }
.system-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 7px; background: color-mix(in srgb, var(--system-color), #181720 87%); color: var(--system-color); }
.system-icon svg { width: 17px; height: 17px; }
.sys-arrow { display: grid; place-items: center; color: var(--accent); opacity: 0; }
.sys-arrow svg { width: 13px; height: 13px; }
.system-button[aria-pressed="true"] .sys-arrow { opacity: 1; }
.side-region { padding: 13px 11px 0; margin-top: auto; }
.side-region label { display: flex; align-items: center; gap: 7px; color: #c6c2d6; font-size: 11.5px; margin: 0 2px 8px; }
.side-region label svg { width: 15px; height: 15px; color: var(--muted); }
.select-shell { position: relative; width: 100%; display: flex; align-items: center; border: 1px solid #343143; min-height: 36px; background: #1c1b26; border-radius: 8px; color: #d9d6e6; }
.select-shell select { appearance: none; width: 100%; background: none; border: 0; padding: 7px 24px 7px 10px; color: inherit; font-size: 12px; }
.select-shell option { background: var(--panel-2); color: var(--text); }
.select-shell > [data-icon="down"] { position: absolute; right: 7px; pointer-events: none; color: var(--muted); }
.select-shell > [data-icon="down"] svg { width: 14px; height: 14px; }
.body-switch { display: flex; padding: 2px; gap: 2px; border: 1px solid #343143; border-radius: 8px; margin: 6px 11px 0; background: #1a1923; }
.body-switch button { flex: 1; min-width: 0; border-radius: 5px; padding: 5px 1px; font-size: 11px; color: var(--muted); }
.body-switch button:hover, .body-switch button[aria-pressed="true"] { background: #30263f; color: #e5d8ff; }
.side-catalog { width: calc(100% - 22px); margin: 8px 11px 10px; min-height: 34px; display: grid; grid-template-columns: 15px 1fr 14px; align-items: center; gap: 7px; padding: 0 7px; text-align: left; border-radius: 8px; color: var(--accent); font-size: 11.5px; }
.side-catalog svg { width: 14px; height: 14px; }
.side-catalog:hover { background: #2c2339; }

.stage { position: relative; min-height: 0; overflow: hidden; isolation: isolate; background: #171622; }
.stage:fullscreen { border: 0; border-radius: 0; }
.stage-background, .viewer { position: absolute; inset: 0; }
.stage-background { pointer-events: none; z-index: -1; overflow: hidden; background: radial-gradient(ellipse at 50% 45%, #302940 0%, #241f33 39%, #1b1928 68%, #171622 100%); }
.stage-grid { position: absolute; inset: 0; opacity: .40; background-image: radial-gradient(circle at center, #8c7da2 0.75px, transparent 1px); background-size: 25px 25px; mask-image: radial-gradient(ellipse at center, #0004 0%, #000 67%); }
.stage-orbit { position: absolute; inset: 50% auto auto 50%; translate: -50% -50%; width: min(80%, 540px); aspect-ratio: 1; border: 1px solid #c5aff215; border-radius: 50%; box-shadow: 0 0 0 35px #c5aff20b, 0 0 0 36px #c5aff20a; }
.stage-orbit::after { content: ""; position: absolute; inset: 12%; border: 1px dashed #c5aff21f; border-radius: 50%; }
.stage-cross-h, .stage-cross-v { position: absolute; background: #baa5e413; }
.stage-cross-h { height: 1px; left: 8%; right: 8%; top: 50%; }
.stage-cross-v { width: 1px; top: 11%; bottom: 10%; left: 50%; }
.viewer { touch-action: none; cursor: grab; }
.viewer:active { cursor: grabbing; }
.viewer canvas { width: 100%; height: 100%; display: block; }
.viewer-status { position: absolute; top: 50%; left: 50%; translate: -50% -50%; display: flex; align-items: center; gap: 9px; border-radius: 9px; background: #1b182b; padding: 12px 16px; color: #e8defb; font-size: 13px; text-align: center; max-width: 83%; }
.spinner { width: 16px; height: 16px; flex-shrink: 0; border: 2px solid #4e3a66; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stage-top, .stage-bottom { position: absolute; left: 14px; right: 14px; display: flex; align-items: center; justify-content: space-between; z-index: 1; pointer-events: none; }
.stage-top { top: 14px; gap: 8px; }
.stage-top > *, .stage-bottom > *, .stage-tools { pointer-events: auto; }
.view-context { display: flex; align-items: center; gap: 7px; padding: 7px 9px; min-height: 32px; color: #ded3ef; font-size: 11px; font-weight: 600; border: 1px solid #473853; border-radius: 7px; background: #261e32eb; }
.view-light { width: 6px; height: 6px; border-radius: 50%; background: var(--context-color, #ba9bff); box-shadow: 0 0 8px var(--context-color, #ba9bff); }
.angle-shell { width: 117px; min-height: 32px; border-color: #40384e; background: #1d1a2ae8; }
.angle-shell select { padding-left: 29px; font-size: 11px; }
.angle-shell > [data-icon="cube"] { position: absolute; left: 8px; color: var(--muted); pointer-events: none; }
.angle-shell > [data-icon="cube"] svg { width: 14px; height: 14px; }
.stage-tools { position: absolute; right: 14px; top: 50%; translate: 0 -50%; display: grid; justify-items: center; padding: 4px; border: 1px solid #3b344a; border-radius: 10px; background: #1b1927f2; box-shadow: 0 3px 12px #0c091643; }
.stage-tools > span { width: 22px; height: 1px; background: #3b344a; margin: 3px 0; }
.stage-tools .icon-btn, .stage-toggle .icon-btn { width: 33px; height: 33px; }
.stage-tools svg, .stage-toggle svg { width: 17px; height: 17px; }
.stage-bottom { bottom: 13px; }
.stage-toggle { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid #41364e; background: #1c1929f0; border-radius: 10px; box-shadow: 0 4px 15px #08061166; }
.stage-mode { padding: 3px 6px; border: 1px solid #413851; color: #b6a6cf; border-radius: 5px; font: 11px ui-monospace, monospace; }
.axis-view { position: relative; width: 39px; height: 39px; margin-left: 2px; color: #beb0d0; }
.axis-view span { position: absolute; left: 15px; top: 25px; width: 14px; height: 1px; transform-origin: left; background: currentColor; }
.axis-view .axis-y { transform: rotate(-90deg); color: #81cbb6; }
.axis-view .axis-x { transform: rotate(-27deg); color: #d89bad; }
.axis-view .axis-z { transform: rotate(147deg); color: #a49ae1; }
.axis-view b, .axis-view i, .axis-view em { position: absolute; font: 9px ui-monospace, monospace; }
.axis-view b { top: 0; left: 13px; color: #81cbb6; }
.axis-view i { top: 13px; right: 3px; color: #d89bad; }
.axis-view em { bottom: 0; left: 0; color: #a49ae1; }
.model-marker { position: absolute; left: 0; top: 0; display: flex; align-items: center; pointer-events: none; z-index: 1; translate: -4px -50%; }
.marker-point { width: 8px; height: 8px; background: #c8adff; border: 1px solid #f1deff; box-shadow: 0 0 0 3px #b999ff44; border-radius: 50%; flex: none; }
.marker-leader { width: clamp(14px, 3vw, 46px); height: 1px; background: #c6a8ffab; flex: none; }
.marker-name { padding: 5px 8px; white-space: nowrap; color: #f3e8ff; background: #2b213ce8; border: 1px solid #745499; border-radius: 6px; font-size: 11px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }

.details { display: flex; flex-direction: column; overflow: hidden; }
.detail-top { display: flex; align-items: center; justify-content: space-between; min-height: 50px; padding: 6px 11px 6px 15px; border-bottom: 1px solid var(--line); }
.detail-top .icon-btn { width: 32px; height: 32px; }
.detail-top .icon-btn svg { width: 16px; height: 16px; }
.details-scroll { min-height: 0; flex: 1; overflow: auto; scrollbar-color: #393549 transparent; scrollbar-width: thin; }
.entity-heading { padding: 15px 15px 11px; }
.entity-icon { margin: 0 0 10px; width: 37px; height: 37px; display: grid; place-items: center; background: #2c223c; border: 1px solid #4a365f; color: var(--accent); border-radius: 10px; }
.entity-icon svg { width: 19px; height: 19px; }
#entity-system { display: block; color: var(--accent); font-size: 10.5px; font-weight: 680; letter-spacing: .045em; text-transform: uppercase; }
#entity-name { margin: 5px 0 3px; font-size: clamp(20px, 2.2vw, 31px); line-height: 1.09; font-weight: 720; letter-spacing: -.038em; overflow-wrap: anywhere; }
#entity-latin { color: var(--muted); font-weight: 450; font-size: 13px; font-style: italic; }
.detail-tabs { display: flex; margin: 0 14px; gap: 3px; border-bottom: 1px solid var(--line); }
.detail-tabs button { position: relative; color: var(--muted); padding: 10px 8px; font-size: 11.5px; white-space: nowrap; border-bottom: 2px solid transparent; }
.detail-tabs button:hover { color: var(--text); }
.detail-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
.entity-body { padding: 13px 15px 15px; }
.entity-body p { color: #c1bed0; font-size: 12.5px; line-height: 1.52; }
.entity-group + .entity-group { margin-top: 11px; }
.entity-group h4 { margin: 0 0 4px; color: #eeeaf7; font-size: 11.5px; font-weight: 660; }
.study-note { display: grid; grid-template-columns: 14px 1fr; gap: 7px; margin-top: 12px; padding: 8px; background: #231d30; border: 1px solid #3b304b; border-radius: 8px; }
.study-note svg { width: 14px; height: 14px; color: var(--accent); margin-top: 1px; }
.study-note p { font-size: 11px; line-height: 1.45; color: #d2c5e6; }
.entity-links { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.entity-links button, .entity-links a { border: 1px solid #41364c; padding: 4px 6px; border-radius: 5px; font-size: 11px; line-height: 1.3; color: #d3bafa; text-align: left; text-decoration: none; }
.entity-links button:hover, .entity-links a:hover { background: #302542; }
.detail-footer { padding: 10px; border-top: 1px solid var(--line); }
.focus-model { display: grid; width: 100%; grid-template-columns: 16px 1fr 15px; align-items: center; gap: 8px; min-height: 36px; border-radius: 8px; padding: 5px 9px; color: #211531; background: var(--accent-strong); text-align: left; font-size: 11.5px; font-weight: 750; }
.focus-model:hover { background: #c9afff; }
.focus-model svg { width: 15px; height: 15px; }

.workspace-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; }
.control-help { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--quiet); }
.control-help span, .footer-btn { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.control-help svg, .footer-btn svg { width: 13px; height: 13px; }
.footer-btn { color: var(--muted); padding: 7px 8px; border-radius: 6px; white-space: nowrap; }
.dialog { width: min(550px, calc(100% - 28px)); max-height: min(680px, 85dvh); border: 1px solid #494058; background: #1a1825; color: var(--text); border-radius: 15px; padding: 0; box-shadow: 0 25px 95px #000a; }
.dialog::backdrop { background: #0c0a13bd; backdrop-filter: blur(5px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 11px 15px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 19px; letter-spacing: -.024em; }
.dialog-search { display: flex; align-items: center; gap: 9px; margin: 13px 15px 8px; padding: 2px 10px; background: #242031; border: 1px solid #524269; border-radius: 8px; color: var(--accent); }
.dialog-search input { height: 38px; min-width: 0; width: 100%; background: transparent; color: var(--text); border: 0; outline: none; }
.dialog-search:focus-within { border-color: var(--accent); }
.browse-summary { font-size: 12px; color: var(--muted); padding: 7px 15px; }
.browse-list { padding: 0 8px 8px; overflow: auto; max-height: min(470px, 60dvh); }
.result { display: grid; grid-template-columns: 34px minmax(0, 1fr) 14px; align-items: center; width: 100%; padding: 7px; gap: 9px; text-align: left; border-radius: 8px; }
.result:hover, .result:focus-visible { background: #2d243d; }
.result strong, .result small { display: block; overflow-wrap: anywhere; }
.result strong { font-size: 13px; }
.result small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.result > [data-icon] { color: var(--accent); }
.result > [data-icon] svg { width: 14px; height: 14px; }
.help-body { padding: 15px 18px; font-size: 13.5px; line-height: 1.52; color: #c4c0d3; }
.help-body h3 { margin: 10px 0 6px; color: var(--text); font-size: 15px; }
.help-body dt { font-weight: 650; color: var(--text); }
.help-body dd { margin: 0 0 8px; }
.help-body ul { padding-left: 18px; }
.help-body a { text-underline-offset: 3px; }
.toast { position: fixed; right: 18px; bottom: 18px; padding: 10px 15px; border: 1px solid #5f4778; border-radius: 9px; background: #2b213a; color: #f4eaff; font-size: 12px; z-index: 5; box-shadow: 0 6px 18px #0007; }

@media (min-width: 1250px) and (min-height: 870px) {
  .workspace { padding-top: 36px; }
  .page-intro { margin-bottom: 26px; }
  .atlas { height: clamp(608px, calc(100dvh - 260px), 970px); gap: 17px; }
  .systems > .side-heading { padding: 19px 17px 15px; }
  .system-list { padding: 0 11px; gap: 5px; }
  .system-button { min-height: 38px; font-size: 13px; }
  .entity-heading, .entity-body { padding-left: 19px; padding-right: 19px; }
  .entity-body p { font-size: 13px; }
  .study-note p { font-size: 11.5px; }
  .detail-tabs { margin-inline: 18px; }
  .detail-tabs button { font-size: 12px; }
  .detail-top { padding-left: 18px; }
}
@media (max-width: 1050px) {
  .workspace, .topbar { padding-inline: 18px; }
  .atlas { grid-template-columns: 172px minmax(0, 1fr) 235px; gap: 10px; }
  .detail-tabs { margin-inline: 9px; }
  .detail-tabs button { padding-inline: 6px; }
}
@media (max-width: 810px) {
  .topbar { gap: 12px; height: 59px; }
  .brand-subtitle, .top-divider { display: none; }
  .atlas { grid-template-columns: 165px minmax(0, 1fr); height: auto; }
  .systems, .stage { min-height: 552px; }
  .details { grid-column: 1 / -1; min-height: 340px; }
  .details-scroll { overflow: visible; }
  .entity-body { max-width: 640px; }
}
@media (max-width: 535px) {
  .workspace, .topbar { padding-inline: 12px; }
  .top-actions { gap: 5px; }
  .top-search, .top-plain { display: grid; width: 35px; min-height: 35px; place-items: center; padding: 0; }
  .top-search > span:not([data-icon]), .top-search kbd, .top-plain .action-text { display: none; }
  .brand { font-size: 18px; }
  .brand-icon { width: 31px; height: 31px; }
  .workspace { padding-top: 20px; }
  .page-intro { align-items: start; }
  .atlas-stats { display: none; }
  .atlas { display: flex; flex-direction: column; }
  .systems { min-height: auto; display: grid; grid-template-columns: 1fr minmax(102px, .8fr); }
  .systems > .side-heading { grid-column: 1 / -1; padding-bottom: 8px; }
  .system-list { display: flex; grid-column: 1 / -1; overflow: auto; scrollbar-width: thin; padding-bottom: 6px; }
  .system-button { display: flex; width: auto; min-height: 34px; padding: 2px 6px 2px 3px; white-space: nowrap; }
  .system-icon { width: 25px; height: 25px; }
  .sys-arrow, .side-region label { display: none; }
  .side-region { margin: 0; padding: 3px 0 3px 9px; }
  .body-switch { margin: 3px 9px 3px 6px; }
  .side-catalog { margin: 1px 8px 4px; }
  .stage { min-height: 500px; min-height: clamp(390px, 68dvh, 520px); }
  .stage-tools { right: 7px; }
  .stage-top, .stage-bottom { left: 8px; right: 8px; }
  .stage-top { top: 8px; }
  .marker-name { max-width: 96px; font-size: 10px; }
  .control-help { display: none; }
  .workspace-footer { justify-content: end; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
@media (min-width: 536px) {
  .system-list { overflow: hidden auto; scrollbar-color: #514363 transparent; scrollbar-width: thin; }
  .side-region, .side-catalog, .body-switch, .systems > .side-heading { flex-shrink: 0; }
}
