:root {
  --anatomy-bg: #0e1116;
  --anatomy-panel: #161b22;
  --anatomy-panel-soft: #1f2630;
  --anatomy-ink: #e6eaf0;
  --anatomy-muted: #8b95a5;
  --anatomy-line: #232b36;
  --anatomy-accent: #19b8a6;
  --anatomy-accent-dark: #2bd0bd;
  --anatomy-alert: #d8a236;
  --anatomy-danger: #e5484d;
  --anatomy-shadow: 0 18px 48px -24px rgba(0, 0, 0, 0.7);
  --anatomy-radius: 9px;

  /* Tipografia do app — compartilhada com a casca */
  --ff-sans: "Montserrat", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Palco do espécime (visor 3D) — escuro grafite */
  --anatomy-stage-dark: #11161d;
  --anatomy-stage-deep: #07090c;

  color-scheme: dark;
  font-family: var(--ff-sans);
  -webkit-font-smoothing: antialiased;
}

body:has(.anatomy-shell) {
  margin: 0;
  background: var(--anatomy-bg);
}

.anatomy-shell,
.anatomy-shell * {
  box-sizing: border-box;
}

.anatomy-shell {
  min-height: 100vh;
  color: var(--anatomy-ink);
  background: var(--anatomy-bg);
}

.anatomy-loading {
  min-height: 60vh;
  display: grid;
  place-items: center;
  gap: 16px;
  color: var(--anatomy-muted);
}

.anatomy-loading__mark {
  width: 44px;
  height: 44px;
  border: 3px solid var(--anatomy-line);
  border-top-color: var(--anatomy-accent);
  border-radius: 50%;
  animation: anatomy-spin 0.8s linear infinite;
}

@keyframes anatomy-spin {
  to {
    transform: rotate(360deg);
  }
}

.anatomy-app {
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(280px, 360px);
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.anatomy-app[data-atlas-mode="compare"] {
  grid-template-columns: minmax(0, 1fr);
}

.anatomy-app[data-atlas-mode="compare"] .anatomy-sidebar,
.anatomy-app[data-atlas-mode="compare"] .anatomy-details {
  display: none;
}

.anatomy-app[data-atlas-mode="compare"] .anatomy-viewer-wrap {
  grid-column: 1 / -1;
  min-height: 0;
}

body.admin-bar .anatomy-app {
  height: calc(100vh - 32px);
  min-height: calc(100vh - 32px);
}

@media (max-width: 782px) {
  body.admin-bar .anatomy-app {
    height: calc(100vh - 46px);
    min-height: calc(100vh - 46px);
  }
}

.anatomy-calibration-toggle[hidden],
.anatomy-shell [hidden] {
  display: none !important;
}

/* Modo embutido: o app 3D vive dentro de outra casca (product-app) e preenche o host. */
.anatomy-embed,
.anatomy-embed * {
  box-sizing: border-box;
}

.anatomy-embed {
  height: 100%;
  min-height: 0;
  color: var(--anatomy-ink);
}

.anatomy-app[data-embedded="true"] {
  height: 100%;
  min-height: 0;
  border-radius: inherit;
  position: relative;
}

/* Embutido: sem barra superior. O unico controle (resetar camera) flutua
   discretamente sobre o palco, mantendo a interface limpa. */
.anatomy-app[data-embedded="true"] .anatomy-topbar {
  min-height: 0;
  padding: 12px;
  position: absolute;
  top: 0;
  right: 0;
  left: auto;
  width: auto;
  background: transparent;
  border-bottom: 0;
  backdrop-filter: none;
  z-index: 15;
}

.anatomy-app[data-embedded="true"] .anatomy-icon-button {
  background: rgba(14, 17, 22, 0.6);
  backdrop-filter: blur(6px);
}

.anatomy-app[data-embedded="true"] [hidden] {
  display: none !important;
}

.anatomy-topbar {
  grid-column: 1 / -1;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--anatomy-line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
}

.anatomy-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.anatomy-brand strong {
  font-size: 17px;
  letter-spacing: 0;
}

.anatomy-brand span,
.anatomy-kicker {
  color: var(--anatomy-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.anatomy-main-menu {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.anatomy-main-menu__item {
  min-width: 136px;
  min-height: 44px;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: var(--anatomy-radius);
  background: transparent;
  color: var(--anatomy-muted);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.anatomy-main-menu__item span {
  color: var(--anatomy-ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.1;
}

.anatomy-main-menu__item small {
  color: var(--anatomy-muted);
  font-size: 11px;
  line-height: 1.1;
}

.anatomy-main-menu__item:hover,
.anatomy-main-menu__item[data-active="true"] {
  border-color: var(--anatomy-line);
  background: #1f2630;
}

.anatomy-main-menu__item[data-active="true"] {
  border-color: rgba(46, 144, 250, 0.35);
  background: rgba(46, 144, 250, 0.14);
}

.anatomy-main-menu__item[data-active="true"] span {
  color: var(--anatomy-accent-dark);
}

.anatomy-main-menu__item:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.anatomy-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.anatomy-button,
.anatomy-icon-button,
.anatomy-select,
.anatomy-search input {
  min-height: 40px;
  border: 1px solid var(--anatomy-line);
  background: var(--anatomy-panel);
  color: var(--anatomy-ink);
  border-radius: var(--anatomy-radius);
  font: inherit;
}

.anatomy-button,
.anatomy-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.anatomy-icon-button {
  width: 40px;
  padding: 0;
}

.anatomy-button:hover,
.anatomy-icon-button:hover {
  border-color: #323c4a;
  transform: translateY(-1px);
}

.anatomy-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.anatomy-button[data-active="true"],
.anatomy-button--primary {
  background: var(--anatomy-accent);
  border-color: var(--anatomy-accent);
  color: #ffffff;
}

.anatomy-sidebar,
.anatomy-details {
  padding: 18px;
  overflow: auto;
  border-color: var(--anatomy-line);
  background: var(--anatomy-bg);
}

/* Sidebar de selecao: busca + regioes fixas no topo, ossos rolam abaixo. */
.anatomy-sidebar {
  border-right: 1px solid var(--anatomy-line);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.anatomy-details {
  border-left: 1px solid var(--anatomy-line);
}

.anatomy-search {
  position: relative;
  margin-bottom: 0;
  flex: none;
}

.anatomy-search input {
  width: 100%;
  padding: 0 12px;
}

.anatomy-sidebar > nav {
  flex: none;
}

.anatomy-sidebar-label {
  display: block;
  flex: none;
  margin-bottom: 8px;
}
.anatomy-sidebar-label + .anatomy-bone-list { margin-top: 0; }

/* Regioes como pills horizontais (selecao rapida, sem ocupar a coluna toda) */
.anatomy-region-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.anatomy-bone-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 2px;
  list-style: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.anatomy-region-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--anatomy-line);
  background: var(--anatomy-panel);
  color: var(--anatomy-muted);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.anatomy-region-button:hover {
  border-color: #323c4a;
  color: var(--anatomy-ink);
}

.anatomy-region-button[data-active="true"] {
  background: rgba(46, 144, 250, 0.16);
  border-color: rgba(46, 144, 250, 0.45);
  color: var(--anatomy-accent-dark);
}

.anatomy-bone-button {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--anatomy-ink);
  text-align: left;
  border-radius: var(--anatomy-radius);
  padding: 9px 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 550;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.anatomy-bone-button:hover {
  background: var(--anatomy-panel);
  border-color: var(--anatomy-line);
}

.anatomy-bone-button[data-active="true"] {
  background: rgba(46, 144, 250, 0.12);
  border-color: rgba(46, 144, 250, 0.4);
}

.anatomy-bone-button[data-active="true"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--anatomy-accent);
}

.anatomy-bone-button[data-active="true"] > span:first-child {
  color: var(--anatomy-accent-dark);
}

.anatomy-bone-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.anatomy-studied-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok, #3fb950);
  box-shadow: 0 0 6px rgba(63, 185, 80, 0.6);
  flex-shrink: 0;
}

.anatomy-status {
  flex: none;
  min-width: 68px;
  text-align: center;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(216, 162, 54, 0.16);
  color: var(--anatomy-alert);
  font-size: 11px;
  line-height: 1;
}

.anatomy-status[data-status="disponivel"] {
  background: rgba(46, 144, 250, 0.14);
  color: var(--anatomy-accent-dark);
}

.anatomy-viewer-wrap {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: #11161d;
}

.anatomy-viewer-stage {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.anatomy-viewer-wrap[data-atlas-mode="compare"] .anatomy-viewer-stage {
  grid-template-columns: minmax(0, 1.08fr) minmax(430px, 0.92fr);
  grid-template-rows: minmax(0, 1fr);
}

.anatomy-viewer {
  position: relative;
  min-height: 540px;
  overflow: hidden;
  /* palco 3D unificado (mesma receita do leitor): glow petróleo sutil + grafite profundo */
  background:
    radial-gradient(120% 85% at 50% -8%, rgba(15, 90, 84, 0.10), transparent 58%),
    radial-gradient(circle at 50% 44%, #171c24, #0b0e12 84%);
}
.anatomy-viewer::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 140px 26px rgba(0, 0, 0, 0.55); /* vinheta premium */
}

.anatomy-photo-atlas {
  min-width: 0;
  display: none;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 12px;
  padding: 14px;
  overflow: auto;
  background: #11161d;
  color: #e6eaf0;
}

.anatomy-viewer-wrap[data-atlas-mode="compare"] .anatomy-photo-atlas {
  border-top: 0;
  border-left: 1px solid rgba(248, 250, 252, 0.12);
  overflow: auto;
}

.anatomy-viewer-wrap[data-atlas-mode="photo"] .anatomy-viewer-stage {
  grid-template-columns: minmax(0, 1fr);
}

.anatomy-viewer-wrap[data-atlas-mode="photo"] .anatomy-viewer {
  display: none;
}

.anatomy-viewer-wrap[data-atlas-mode="photo"] .anatomy-photo-atlas,
.anatomy-viewer-wrap[data-atlas-mode="compare"] .anatomy-photo-atlas {
  display: grid;
}

.anatomy-photo-head,
.anatomy-photo-meta,
.anatomy-photo-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.anatomy-photo-head strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  line-height: 1.25;
}

.anatomy-photo-head span {
  flex: none;
  padding: 4px 8px;
  border: 1px solid rgba(248, 250, 252, 0.18);
  border-radius: 999px;
  color: #8b95a5;
  font-size: 11px;
}

.anatomy-photo-head span[data-status="curadoria"] {
  color: #e7c06b;
  border-color: rgba(253, 230, 138, 0.36);
}

.anatomy-photo-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.anatomy-photo-tab {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(248, 250, 252, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: #8b95a5;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.anatomy-photo-tab[data-active="true"],
.anatomy-photo-tab:hover {
  border-color: rgba(46, 144, 250, 0.72);
  color: #ffffff;
}

.anatomy-photo-frame {
  position: relative;
  aspect-ratio: var(--photo-width, 3780) / var(--photo-height, 980);
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(248, 250, 252, 0.14);
  border-radius: var(--anatomy-radius);
  background: #07090c;
}

.anatomy-photo-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.anatomy-compare-workbench {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
}

.anatomy-compare-photo {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.anatomy-compare-photo .anatomy-photo-frame {
  width: 100%;
}

.anatomy-compare-photo .anatomy-photo-frame img {
  height: 100%;
  object-fit: contain;
}

.anatomy-compare-guide {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.anatomy-compare-study {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(248, 250, 252, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
}

.anatomy-compare-study-head {
  display: grid;
  gap: 4px;
}

.anatomy-compare-study-head p {
  margin: 0;
}

.anatomy-compare-study-head strong {
  color: #e6eaf0;
  font-size: 13px;
  line-height: 1.32;
}

.anatomy-compare-focus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(46, 144, 250, 0.3);
  border-radius: 6px;
  background: rgba(46, 144, 250, 0.12);
}

.anatomy-compare-focus span {
  grid-column: 1 / -1;
  color: #4aa3fb;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.anatomy-compare-focus strong {
  color: #ffffff;
  font-size: 13px;
  line-height: 1.2;
}

.anatomy-compare-focus small {
  justify-self: end;
  color: #e7c06b;
  font-size: 11px;
  font-weight: 700;
}

.anatomy-compare-focus small::before,
.anatomy-compare-landmark small::before,
.anatomy-photo-hotspot span small::before {
  content: "";
  width: 6px;
  height: 6px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
  background: #d8a236;
  vertical-align: 0.05em;
}

.anatomy-compare-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: #8b95a5;
  font-size: 11px;
  line-height: 1.35;
}

.anatomy-compare-tour {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.anatomy-compare-tour button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(46, 144, 250, 0.32);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.76);
  color: #1f2630;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.anatomy-compare-tour button:hover {
  border-color: rgba(46, 144, 250, 0.7);
  background: rgba(46, 144, 250, 0.14);
}

.anatomy-compare-tour span {
  min-width: 44px;
  padding: 6px 8px;
  border: 1px solid rgba(248, 250, 252, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: #e6eaf0;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.anatomy-compare-landmarks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.anatomy-compare-landmark {
  min-height: 38px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 7px 8px;
  border: 1px solid rgba(248, 250, 252, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  color: #e6eaf0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.anatomy-compare-landmark:hover,
.anatomy-compare-landmark[data-active="true"] {
  border-color: rgba(46, 144, 250, 0.72);
  background: rgba(46, 144, 250, 0.13);
}

.anatomy-compare-landmark[data-confidence="alta"] {
  border-color: rgba(34, 197, 94, 0.26);
}

.anatomy-compare-landmark[data-confidence="alta"] small,
.anatomy-compare-landmark[data-confidence="alta"] small::before,
.anatomy-photo-hotspot[data-confidence="alta"] span small,
.anatomy-photo-hotspot[data-confidence="alta"] span small::before,
.anatomy-compare-focus small[data-confidence="alta"] {
  color: #3fb950;
}

.anatomy-compare-landmark[data-confidence="alta"] small::before,
.anatomy-photo-hotspot[data-confidence="alta"] span small::before,
.anatomy-compare-focus small[data-confidence="alta"]::before {
  background: #22c55e;
}

.anatomy-compare-landmark[data-confidence="media"] {
  border-color: rgba(250, 204, 21, 0.24);
}

.anatomy-compare-landmark[data-confidence="media"] small,
.anatomy-photo-hotspot[data-confidence="media"] span small,
.anatomy-compare-focus small[data-confidence="media"] {
  color: #e7c06b;
}

.anatomy-compare-landmark[data-confidence="revisar"] {
  border-color: rgba(251, 146, 60, 0.28);
}

.anatomy-compare-landmark[data-confidence="revisar"] small,
.anatomy-photo-hotspot[data-confidence="revisar"] span small,
.anatomy-compare-focus small[data-confidence="revisar"] {
  color: #d8a236;
}

.anatomy-compare-landmark span {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.18;
}

.anatomy-compare-landmark small {
  color: #e7c06b;
  font-size: 10px;
}

.anatomy-photo-lab {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 14px;
}

.anatomy-photo-lab-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.anatomy-photo-lab-main .anatomy-photo-frame {
  width: 100%;
  height: min(64vh, 720px);
  aspect-ratio: auto;
}

.anatomy-photo-lab-main .anatomy-photo-frame img {
  height: 100%;
  object-fit: contain;
}

.anatomy-photo-lab-rail {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.anatomy-photo-card {
  min-height: 86px;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(248, 250, 252, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: #e6eaf0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.anatomy-photo-card:hover,
.anatomy-photo-card[data-active="true"] {
  border-color: rgba(46, 144, 250, 0.72);
  background: rgba(46, 144, 250, 0.13);
}

.anatomy-photo-card img {
  width: 86px;
  height: 66px;
  border-radius: 4px;
  object-fit: cover;
  background: #07090c;
}

.anatomy-photo-card span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.anatomy-photo-card strong {
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.anatomy-photo-card small {
  color: #8b95a5;
  font-size: 11px;
}

.anatomy-photo-study {
  display: grid;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid rgba(248, 250, 252, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
}

.anatomy-photo-study-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.anatomy-photo-study-head p {
  margin: 0 0 4px;
}

.anatomy-photo-study-head strong {
  display: block;
  max-width: 760px;
  color: #e6eaf0;
  font-size: 13px;
  line-height: 1.3;
}

.anatomy-photo-study-nav {
  flex: none;
  display: flex;
  gap: 6px;
}

.anatomy-photo-step {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(248, 250, 252, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: #e6eaf0;
  cursor: pointer;
  font: inherit;
  font-size: 19px;
  line-height: 1;
}

.anatomy-photo-step:hover {
  border-color: rgba(46, 144, 250, 0.72);
  background: rgba(46, 144, 250, 0.13);
}

.anatomy-photo-observe {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.anatomy-photo-observe li {
  position: relative;
  padding-left: 12px;
  color: #8b95a5;
  font-size: 11px;
  line-height: 1.35;
}

.anatomy-photo-observe li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.56em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #4aa3fb;
}

.anatomy-photo-hotspots {
  position: absolute;
  inset: 0;
}

.anatomy-photo-hotspot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 14px;
  height: 14px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  background: #2e90fa;
  box-shadow: 0 0 0 4px rgba(46, 144, 250, 0.26), 0 8px 16px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.anatomy-photo-hotspot:hover,
.anatomy-photo-hotspot[data-active="true"] {
  background: #d8a236;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.26), 0 8px 16px rgba(0, 0, 0, 0.28);
}

.anatomy-photo-hotspot[data-status="rascunho"] {
  background: #d8a236;
  box-shadow: 0 0 0 4px rgba(216, 162, 54, 0.25), 0 8px 16px rgba(0, 0, 0, 0.24);
}

.anatomy-photo-hotspot[data-confidence="alta"] {
  background: #3fb950;
  box-shadow: 0 0 0 4px rgba(63, 185, 80, 0.25), 0 8px 16px rgba(0, 0, 0, 0.24);
}

.anatomy-photo-hotspot[data-confidence="media"] {
  background: #d8a236;
  box-shadow: 0 0 0 4px rgba(202, 138, 4, 0.25), 0 8px 16px rgba(0, 0, 0, 0.24);
}

.anatomy-photo-hotspot span {
  position: absolute;
  left: 18px;
  top: 50%;
  max-width: 150px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(15, 17, 20, 0.88);
  color: #ffffff;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.18;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity 0.12s ease;
  white-space: normal;
}

.anatomy-photo-hotspot span small {
  display: block;
  margin-top: 2px;
  color: #e7c06b;
  font-size: 10px;
  font-weight: 600;
}

.anatomy-photo-hotspot:hover span,
.anatomy-photo-hotspot[data-active="true"] span {
  opacity: 1;
}

.anatomy-photo-meta {
  color: #8b95a5;
  font-size: 12px;
  line-height: 1.4;
}

.anatomy-photo-meta a {
  color: #4aa3fb;
}

.anatomy-photo-audit {
  display: grid;
  gap: 6px;
  margin: 0;
  color: #8b95a5;
  font-size: 11px;
}

.anatomy-photo-audit div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
}

.anatomy-photo-audit dt {
  color: #8b95a5;
}

.anatomy-photo-audit dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.anatomy-photo-audit--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: 2px;
}

.anatomy-photo-empty {
  min-height: 100%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  text-align: center;
  color: #8b95a5;
}

.anatomy-photo-empty strong {
  color: #ffffff;
}

.anatomy-photo-summary {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid rgba(46, 144, 250, 0.22);
  border-radius: var(--anatomy-radius);
  background: #1f2630;
}

.anatomy-model-asset-summary {
  margin: 14px 0;
  padding: 11px 12px;
  border: 1px solid rgba(51, 65, 85, 0.14);
  border-radius: var(--anatomy-radius);
  background: #1f2630;
}

.anatomy-photo-summary div,
.anatomy-model-asset-summary div {
  display: grid;
  gap: 3px;
}

.anatomy-photo-summary strong,
.anatomy-model-asset-summary strong {
  color: var(--anatomy-accent-dark);
  font-size: 13px;
}

.anatomy-photo-summary span,
.anatomy-model-asset-summary span {
  color: var(--anatomy-muted);
  font-size: 12px;
}

.anatomy-viewer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.anatomy-viewer canvas[data-pickable="true"] {
  cursor: pointer;
}

.anatomy-viewer canvas[data-calibrating="true"] {
  cursor: copy;
}

.anatomy-annotation-label-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.anatomy-annotation-label-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.anatomy-annotation-leader {
  fill: none;
  stroke: rgba(51, 67, 74, 0.62);
  stroke-width: 1.05;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.92;
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
}

.anatomy-annotation-leader[data-status="correct"] {
  stroke: rgba(63, 185, 80, 0.52);
}

.anatomy-annotation-leader[data-status="wrong"] {
  stroke: rgba(229, 72, 77, 0.5);
}

.anatomy-annotation-label {
  position: absolute;
  box-sizing: border-box;
  max-width: 176px;
  transform: none;
  min-height: 26px;
  padding: 6px 10px 6px 11px;
  border: 1px solid rgba(139, 149, 165, 0.44);
  border-radius: 4px;
  background: rgba(249, 251, 251, 0.96);
  color: #11161d;
  box-shadow:
    0 1px 2px rgba(22, 32, 38, 0.08),
    0 10px 20px rgba(30, 41, 49, 0.1);
  font-family: inherit;
  font-size: 11.5px;
  line-height: 1.22;
  font-weight: 650;
  letter-spacing: 0;
  white-space: normal;
  text-wrap: balance;
  overflow: hidden;
  text-shadow: none;
  -webkit-font-smoothing: antialiased;
  contain: layout style;
  transition: opacity 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.anatomy-annotation-label::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: rgba(15, 90, 84, 0.72);
}

.anatomy-annotation-label[data-placement="left"]::before {
  inset: 0 0 0 auto;
}

.anatomy-annotation-label[data-placement="top"]::before {
  inset: auto 0 0 0;
  width: auto;
  height: 2px;
}

.anatomy-annotation-label[data-placement="bottom"]::before {
  inset: 0 0 auto 0;
  width: auto;
  height: 2px;
}

.anatomy-annotation-label[data-status="correct"] {
  color: #0f5132;
  border-color: rgba(63, 185, 80, 0.36);
}

.anatomy-annotation-label[data-status="correct"]::before {
  background: rgba(63, 185, 80, 0.72);
}

.anatomy-annotation-label[data-status="wrong"] {
  color: #7f1d1d;
  border-color: rgba(229, 72, 77, 0.38);
}

.anatomy-annotation-label[data-status="wrong"]::before {
  background: rgba(229, 72, 77, 0.7);
}

.anatomy-annotation-label[data-status="part"],
.anatomy-annotation-label[data-status="calibration"] {
  color: #11161d;
  border-color: rgba(15, 90, 84, 0.34);
}

.anatomy-viewer-message {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(440px, calc(100% - 40px));
  transform: translate(-50%, -50%);
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--anatomy-line);
  border-radius: var(--anatomy-radius);
  box-shadow: var(--anatomy-shadow);
}

.anatomy-viewer-message[hidden] {
  display: none !important;
}

.anatomy-viewer-message strong {
  font-size: 18px;
}

.anatomy-viewer-message p {
  margin: 0;
  color: var(--anatomy-muted);
}

/* Estado de carregamento do modelo 3D: painel escuro + spinner */
.anatomy-viewer-message[data-loading="true"] {
  background: rgba(16, 20, 24, 0.62);
  border-color: rgba(255, 255, 255, 0.10);
  color: var(--anatomy-ink);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.75);
}
.anatomy-viewer-message[data-loading="true"] strong { color: var(--anatomy-ink); }

.anatomy-viewer-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--anatomy-accent);
  border-radius: 50%;
  animation: anatomy-spin 0.8s linear infinite;
}

/* Acidentes osseos clicaveis (localizam o ponto no modelo 3D) */
.anatomy-landmark-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.anatomy-landmark-static { padding: 6px 2px; color: var(--anatomy-muted); }

.anatomy-landmark-button {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--anatomy-line);
  border-radius: var(--anatomy-radius);
  background: var(--anatomy-panel);
  color: var(--anatomy-ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.anatomy-landmark-button:hover { border-color: rgba(46, 144, 250, 0.45); background: #1f2630; }
.anatomy-landmark-button[data-active="true"] {
  border-color: rgba(46, 144, 250, 0.55);
  background: rgba(46, 144, 250, 0.14);
}
.anatomy-landmark-name { font-weight: 600; }
.anatomy-landmark-button .anatomy-landmark-meta { margin-left: 0; }
.anatomy-landmark-go {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--anatomy-accent-dark);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.anatomy-landmark-button:hover .anatomy-landmark-go,
.anatomy-landmark-button[data-active="true"] .anatomy-landmark-go { opacity: 1; }

/* Selo "cai em prova" (consistente com o atlas fotografico) */
.anatomy-exam-flag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(216, 162, 54, 0.16);
  color: var(--anatomy-alert);
}

/* Controle compacto de foco por ponto (substitui a lista duplicada) */
.anatomy-parts-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--anatomy-line);
  border-radius: var(--anatomy-radius);
  background: var(--anatomy-panel);
}
.anatomy-parts-control__status { font-size: 13px; color: var(--anatomy-muted); }
.anatomy-parts-control__status strong { color: var(--anatomy-accent-dark); font-weight: 650; }

.anatomy-landmark-audio {
  flex: 1 0 100%;
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--anatomy-line);
}
.anatomy-landmark-audio__head { display: flex; align-items: center; gap: 9px; }
.anatomy-landmark-audio__head > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--anatomy-accent);
  color: #fff;
  font-weight: 700;
}
.anatomy-landmark-audio__head div { display: grid; gap: 1px; }
.anatomy-landmark-audio__head small { color: var(--anatomy-muted); }
.anatomy-landmark-audio audio { width: 100%; height: 36px; }
.anatomy-landmark-audio details { font-size: 12px; color: var(--anatomy-muted); }
.anatomy-landmark-audio details p { margin: 7px 0 0; line-height: 1.5; }

/* Acessibilidade: foco de teclado visivel em todo o atlas (3D e embutido) */
.anatomy-app :focus-visible {
  outline: 2px solid var(--anatomy-accent);
  outline-offset: 2px;
  border-radius: 5px;
}

.anatomy-viewer-footer {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-top: 1px solid var(--anatomy-line);
  background: rgba(255, 255, 255, 0.9);
}

.anatomy-viewer-footer p {
  margin: 0;
  color: var(--anatomy-muted);
  font-size: 13px;
}

.anatomy-panel {
  background: var(--anatomy-panel);
  border: 1px solid var(--anatomy-line);
  border-radius: var(--anatomy-radius);
  padding: 16px;
}

.anatomy-panel + .anatomy-panel {
  margin-top: 14px;
}

.anatomy-panel h2,
.anatomy-panel h3 {
  margin: 0 0 10px;
  letter-spacing: 0;
}

.anatomy-panel h2 {
  font-size: 24px;
}

.anatomy-panel h3 {
  font-size: 15px;
}

.anatomy-panel p,
.anatomy-panel li {
  color: var(--anatomy-muted);
  line-height: 1.55;
}

.anatomy-panel ul {
  margin: 0;
  padding-left: 18px;
}

.anatomy-landmark-meta {
  display: block;
  margin-top: 2px;
  color: var(--anatomy-muted);
  font-size: 11px;
  line-height: 1.35;
}

.anatomy-calibration {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid rgba(46, 144, 250, 0.26);
  border-radius: var(--anatomy-radius);
  background: linear-gradient(180deg, #1f2630 0%, #1f2630 100%);
}

.anatomy-calibration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.anatomy-calibration-session {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 6px;
  background: #ffffff;
}

.anatomy-calibration-session strong {
  color: var(--anatomy-ink);
  font-size: 13px;
  line-height: 1.25;
}

.anatomy-calibration-session span {
  color: var(--anatomy-muted);
  font-size: 12px;
  line-height: 1.35;
}

.anatomy-calibration-progress {
  display: grid;
  gap: 8px;
  padding: 10px 0 2px;
}

.anatomy-calibration-progress div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.anatomy-calibration-progress strong {
  min-width: 0;
  color: var(--anatomy-ink);
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.anatomy-calibration-progress span {
  flex: none;
  color: var(--anatomy-muted);
  font-size: 12px;
}

.anatomy-calibration-progress i {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #1f2630;
}

.anatomy-calibration-progress i::before {
  content: "";
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: var(--anatomy-accent);
}

.anatomy-calibration-workbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 8px;
}

.anatomy-calibration-queue {
  max-height: 214px;
  display: grid;
  gap: 6px;
  overflow: auto;
  padding-right: 2px;
}

.anatomy-queue-button {
  min-height: 42px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--anatomy-line);
  border-radius: 6px;
  background: var(--anatomy-panel);
  color: var(--anatomy-ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.anatomy-queue-button:hover,
.anatomy-queue-button[data-active="true"] {
  border-color: var(--anatomy-accent);
  background: #1f2630;
}

.anatomy-queue-button > span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #1f2630;
  color: var(--anatomy-muted);
  font-size: 11px;
  font-weight: 700;
}

.anatomy-queue-button strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.anatomy-queue-button small {
  color: var(--anatomy-muted);
  font-size: 11px;
  line-height: 1.2;
  text-align: right;
}

.anatomy-queue-button[data-status="saved"] > span {
  background: rgba(63, 185, 80, 0.16);
  color: #166534;
}

.anatomy-queue-button[data-status="preview"] > span {
  background: rgba(46, 144, 250, 0.14);
  color: var(--anatomy-accent-dark);
}

.anatomy-surface-style {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(46, 144, 250, 0.2);
  border-radius: var(--anatomy-radius);
  background: rgba(46, 144, 250, 0.07);
}

.anatomy-surface-style strong {
  color: var(--anatomy-accent-dark);
  font-size: 13px;
}

.anatomy-surface-style span {
  color: var(--anatomy-muted);
  font-size: 12px;
  line-height: 1.35;
}

.anatomy-toggle-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--anatomy-muted);
  font-size: 13px;
}

.anatomy-calibration-preview {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(46, 144, 250, 0.26);
  border-radius: var(--anatomy-radius);
  background: #ffffff;
}

.anatomy-calibration-preview span {
  color: var(--anatomy-muted);
  font-size: 12px;
}

.anatomy-candidates {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(46, 144, 250, 0.18);
  border-radius: var(--anatomy-radius);
  background: #1f2630;
}

.anatomy-candidate-list {
  max-height: 230px;
  display: grid;
  gap: 6px;
  overflow: auto;
  padding-right: 2px;
}

.anatomy-candidate-button {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--anatomy-line);
  border-radius: var(--anatomy-radius);
  background: var(--anatomy-panel);
  color: var(--anatomy-ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.anatomy-candidate-button:hover {
  border-color: var(--anatomy-accent);
  background: rgba(46, 144, 250, 0.14);
}

.anatomy-candidate-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.anatomy-candidate-button span {
  display: grid;
  gap: 2px;
}

.anatomy-candidate-button small {
  color: var(--anatomy-muted);
  font-size: 11px;
}

.anatomy-parts {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid rgba(46, 144, 250, 0.18);
  border-radius: var(--anatomy-radius);
  background: #1f2630;
}

.anatomy-part-active {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(46, 144, 250, 0.22);
  border-radius: var(--anatomy-radius);
  background: rgba(46, 144, 250, 0.14);
}

.anatomy-part-active small,
.anatomy-part-button small {
  color: var(--anatomy-muted);
  font-size: 11px;
}

.anatomy-part-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
}

.anatomy-part-list {
  max-height: 250px;
  display: grid;
  gap: 6px;
  overflow: auto;
  padding-right: 2px;
}

.anatomy-part-button {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--anatomy-line);
  border-radius: var(--anatomy-radius);
  background: var(--anatomy-panel);
  color: var(--anatomy-ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.anatomy-part-button:hover,
.anatomy-part-button[data-active="true"] {
  border-color: var(--anatomy-accent);
  background: rgba(46, 144, 250, 0.14);
}

.anatomy-calibration-field {
  display: grid;
  gap: 6px;
}

.anatomy-calibration-field span {
  color: var(--anatomy-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.anatomy-calibration-field select,
.anatomy-calibration-field input[type="text"],
.anatomy-calibration-field input[type="range"],
.anatomy-calibration-field input[type="color"] {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--anatomy-line);
  border-radius: var(--anatomy-radius);
  background: var(--anatomy-panel);
  color: var(--anatomy-ink);
  font: inherit;
}

.anatomy-calibration-field input[type="color"] {
  padding: 4px;
}

.anatomy-calibration-result {
  display: grid;
  gap: 6px;
  margin: 0;
  font-size: 12px;
}

.anatomy-calibration-result--preview {
  padding-top: 2px;
}

.anatomy-calibration-result div {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
}

.anatomy-calibration-result dt {
  color: var(--anatomy-muted);
}

.anatomy-calibration-result dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.anatomy-calibration-empty {
  margin: 0;
}

.anatomy-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.anatomy-panel-head p {
  margin: 0;
}

.anatomy-panel-head span {
  flex: none;
  min-width: 54px;
  padding: 4px 8px;
  border: 1px solid var(--anatomy-line);
  border-radius: 999px;
  color: var(--anatomy-muted);
  font-size: 12px;
  text-align: center;
}

.anatomy-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.anatomy-empty {
  padding: 16px;
  color: var(--anatomy-muted);
}

.anatomy-license-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 64px 20px;
  color: var(--anatomy-ink);
}

.anatomy-license-page h1 {
  margin: 0 0 16px;
  font-size: 38px;
}

.anatomy-license-page p {
  color: var(--anatomy-muted);
  line-height: 1.7;
}

@media (max-width: 1080px) {
  .anatomy-app {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .anatomy-details {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--anatomy-line);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .anatomy-panel + .anatomy-panel {
    margin-top: 0;
  }
}

@media (max-width: 760px) {
  .anatomy-app {
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  body.admin-bar .anatomy-app {
    height: auto;
    min-height: 100vh;
  }

  .anatomy-topbar {
    align-items: stretch;
    flex-direction: column;
    position: relative;
  }

  .anatomy-main-menu {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .anatomy-main-menu__item {
    flex: 0 0 148px;
  }

  .anatomy-toolbar {
    justify-content: stretch;
  }

  .anatomy-toolbar .anatomy-button {
    flex: 1 1 auto;
  }

  .anatomy-sidebar,
  .anatomy-details {
    border: 0;
    padding: 14px;
  }

  .anatomy-sidebar {
    order: 2;
  }

  .anatomy-viewer-wrap {
    order: 1;
  }

  .anatomy-details {
    order: 3;
    display: block;
  }

  .anatomy-viewer {
    min-height: 420px;
  }

  .anatomy-viewer-wrap[data-atlas-mode="photo"] .anatomy-viewer-stage {
    grid-template-columns: minmax(0, 1fr);
  }

  .anatomy-viewer-wrap[data-atlas-mode="compare"] .anatomy-viewer-stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(360px, 52vh) auto;
  }

  .anatomy-photo-atlas {
    min-height: 420px;
    border-top: 1px solid var(--anatomy-line);
  }

  .anatomy-viewer-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .anatomy-calibration-grid,
  .anatomy-part-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px) {
  .anatomy-app[data-atlas-mode="compare"],
  .anatomy-app[data-atlas-mode="photo"] {
    height: 100vh;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    background: #11161d;
  }

  body.admin-bar .anatomy-app[data-atlas-mode="compare"],
  body.admin-bar .anatomy-app[data-atlas-mode="photo"] {
    height: calc(100vh - 46px);
    min-height: calc(100vh - 46px);
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-topbar,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-topbar {
    min-height: 50px;
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 10px;
    padding: 7px 12px;
    position: relative;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-brand,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-brand {
    min-width: 0;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-brand strong,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-brand strong {
    font-size: 14px;
    line-height: 1.15;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-brand span,
  .anatomy-app[data-atlas-mode="compare"] .anatomy-calibration-toggle,
  .anatomy-app[data-atlas-mode="compare"] .anatomy-icon-button,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-brand span,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-calibration-toggle,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-icon-button {
    display: none !important;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-main-menu,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-main-menu {
    justify-content: flex-end;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-main-menu__item,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-main-menu__item {
    min-width: auto;
    min-height: 34px;
    padding: 5px 9px;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-main-menu__item small,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-main-menu__item small {
    display: none;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-toolbar,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-toolbar {
    margin-left: auto;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-sidebar,
  .anatomy-app[data-atlas-mode="compare"] .anatomy-details,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-sidebar,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-details {
    display: none;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-viewer-wrap,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-viewer-wrap {
    order: initial;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) 34px;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-viewer-stage {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(245px, 48%) minmax(0, 1fr);
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-viewer {
    min-height: 0;
  }

  .anatomy-app[data-atlas-mode="photo"] .anatomy-viewer-stage {
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-photo-atlas {
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
    overflow: auto;
    border-left: 0;
    border-top: 1px solid rgba(248, 250, 252, 0.12);
  }

  .anatomy-app[data-atlas-mode="photo"] .anatomy-photo-atlas {
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px;
    overflow: hidden;
  }

  .anatomy-app[data-atlas-mode="photo"] .anatomy-photo-lab {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 230px);
    gap: 10px;
  }

  .anatomy-app[data-atlas-mode="photo"] .anatomy-photo-lab-main .anatomy-photo-frame {
    height: 100%;
    min-height: 0;
  }

  .anatomy-app[data-atlas-mode="photo"] .anatomy-photo-lab-rail {
    overflow: auto;
  }

  .anatomy-app[data-atlas-mode="photo"] .anatomy-photo-card {
    min-height: 70px;
    grid-template-columns: 72px minmax(0, 1fr);
    padding: 6px;
  }

  .anatomy-app[data-atlas-mode="photo"] .anatomy-photo-card img {
    width: 72px;
    height: 54px;
  }

  .anatomy-app[data-atlas-mode="photo"] .anatomy-photo-meta,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-photo-audit {
    font-size: 11px;
  }

  .anatomy-app[data-atlas-mode="photo"] .anatomy-photo-study {
    padding: 9px 10px;
  }

  .anatomy-app[data-atlas-mode="photo"] .anatomy-photo-study-head strong {
    font-size: 12px;
  }

  .anatomy-app[data-atlas-mode="photo"] .anatomy-photo-observe {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-photo-head {
    min-height: 30px;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-photo-head .anatomy-kicker,
  .anatomy-app[data-atlas-mode="compare"] .anatomy-photo-head span,
  .anatomy-app[data-atlas-mode="compare"] .anatomy-photo-meta,
  .anatomy-app[data-atlas-mode="compare"] .anatomy-photo-audit {
    display: none;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-photo-head strong {
    margin: 0;
    font-size: 13px;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-photo-frame {
    align-self: center;
    width: 100%;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-compare-workbench {
    gap: 8px;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-compare-study {
    padding: 9px 10px;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-compare-study-head strong {
    font-size: 12px;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-compare-steps {
    display: none;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-compare-landmarks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-photo-hotspot {
    width: 12px;
    height: 12px;
    border-width: 2px;
    box-shadow: 0 0 0 3px rgba(216, 162, 54, 0.24);
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-viewer-footer,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-viewer-footer {
    min-height: 34px;
    padding: 6px 10px;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-viewer-footer p,
  .anatomy-app[data-atlas-mode="photo"] .anatomy-viewer-footer p {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 760px) {
  .anatomy-app[data-atlas-mode="photo"] .anatomy-photo-lab {
    grid-template-columns: minmax(0, 1fr);
  }

  .anatomy-app[data-atlas-mode="photo"] .anatomy-photo-lab-rail {
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 220px);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .anatomy-photo-audit--compact {
    grid-template-columns: 1fr;
  }

  .anatomy-photo-study-head {
    align-items: stretch;
    flex-direction: column;
  }

  .anatomy-photo-study-nav {
    justify-content: stretch;
  }

  .anatomy-photo-step {
    flex: 1;
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-compare-landmarks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .anatomy-app[data-atlas-mode="compare"] .anatomy-compare-landmark {
    min-height: 34px;
    padding: 6px 7px;
  }
}

/* =========================================================================
   Harmonizacao app escuro — Montserrat. Titulos em peso forte, rotulos
   tecnicos em mono. Sem mexer no layout.
   ========================================================================= */

.anatomy-brand strong {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.anatomy-kicker,
.anatomy-brand span,
.anatomy-status,
.anatomy-photo-tab,
.anatomy-photo-head span {
  font-family: var(--ff-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.anatomy-panel h2,
.anatomy-panel h3,
.anatomy-photo-head strong,
.anatomy-photo-study-head strong,
.anatomy-compare-study-head strong {
  font-weight: 700;
  letter-spacing: -0.015em;
}

.anatomy-panel h2 {
  font-size: 1.32rem;
  line-height: 1.12;
  margin: 4px 0 2px;
}

.anatomy-topbar {
  background: color-mix(in srgb, var(--anatomy-bg) 84%, transparent);
}

/* =========================================================================
   Atlas 3D embutido (dentro do product-app) — selecao mobile.
   Em telas pequenas a selecao vira um seletor horizontal compacto ACIMA do
   visor: facilita escolher regiao/osso sem empurrar o modelo para fora da tela.
   ========================================================================= */
@media (max-width: 860px) {
  /* App cresce com o conteudo; quem rola e o .pa-content (casca). */
  .anatomy-embed { height: auto; min-height: 100%; }
  .anatomy-app[data-embedded="true"] {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100%;
    overflow: visible;
  }

  .anatomy-app[data-embedded="true"] .anatomy-sidebar {
    order: 1;
    flex: none;
    gap: 8px;
    padding: 12px 12px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--anatomy-line);
    overflow: visible;
  }

  /* Modelo 3D fixo no topo enquanto a lista de pontos rola por baixo. */
  .anatomy-app[data-embedded="true"] .anatomy-viewer-wrap {
    order: 2;
    position: sticky;
    top: 0;
    z-index: 5;
    height: 44vh;
    min-height: 280px;
    flex: none;
    background: var(--anatomy-stage-dark);
    box-shadow: 0 10px 24px -16px rgba(0, 0, 0, 0.8);
  }
  .anatomy-app[data-embedded="true"] .anatomy-viewer { min-height: 0; }
  .anatomy-app[data-embedded="true"] .anatomy-details {
    order: 3;
    overflow: visible;
  }

  .anatomy-app[data-embedded="true"] .anatomy-region-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .anatomy-app[data-embedded="true"] .anatomy-region-list::-webkit-scrollbar { display: none; }
  .anatomy-app[data-embedded="true"] .anatomy-region-button { flex: 0 0 auto; }

  .anatomy-app[data-embedded="true"] .anatomy-bone-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding: 2px 2px 6px;
    scroll-snap-type: x proximity;
  }
  .anatomy-app[data-embedded="true"] .anatomy-bone-button {
    flex: 0 0 auto;
    min-height: 42px;
    scroll-snap-align: start;
  }
  .anatomy-app[data-embedded="true"] .anatomy-bone-button[data-active="true"]::before { display: none; }
}

/* Paisagem em tela baixa (celular deitado, <=860px): mantem o layout rolavel
   comprovado do retrato, apenas encurtando o modelo fixo para sobrar espaco de
   leitura dos pontos abaixo. */
@media (max-width: 860px) and (orientation: landscape) and (max-height: 540px) {
  .anatomy-app[data-embedded="true"] .anatomy-viewer-wrap { height: 60vh; min-height: 190px; }
}
