:root {
  --bg: #14161a;
  --panel: #1d2025;
  --text: #e8e8e8;
  --muted: #9aa0a8;
  --accent: #4fa3ff;
  --draft: #e0b34f;
  --border: #2c3038;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: linear-gradient(rgba(14, 15, 18, 0.72), rgba(14, 15, 18, 0.72)), url('wallpaper.jpg') center / cover fixed no-repeat, var(--bg);
  color: var(--text);
}

[x-cloak] { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.topbar h1 { font-size: 1.1rem; margin: 0; }

.drafts-toggle {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
}

.layout { padding: 16px; }

.bone-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.bone-card {
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.bone-card.draft { border-color: var(--draft); }

.bone-title { font-weight: 600; }
.bone-latin { color: var(--muted); font-style: italic; font-size: 0.9rem; }

.draft-badge {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 0.7rem;
  color: #1a1a1a;
  background: var(--draft);
  border-radius: 4px;
  padding: 2px 6px;
}

.viewer-pane { max-width: 900px; margin: 0 auto; }

.back {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px 0;
}

.viewer-pane h2 { margin: 12px 0 4px; }
.viewer-pane .subtitle { color: var(--muted); margin: 0 0 4px; }
.source-credit {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
  margin: 0 0 12px;
  overflow-wrap: break-word;
}

.lang-switch { display: flex; gap: 6px; margin-bottom: 12px; }
.lang-switch button {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}
.lang-switch button.active { border-color: var(--accent); color: var(--accent); }

model-viewer {
  width: 100%;
  height: min(60vh, 520px);
  background: #0e0f12;
  border-radius: 10px;
}

.hotspot {
  background: var(--accent);
  border: 1.5px solid #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #0e0f12;
  line-height: 1;
  transform: scale(0.5);
  transition: opacity 0.15s, transform 0.15s;
}
/* Обычная точка — маленький кружок без цифры; цифра и подпись появляются
   у выбранной точки и при наведении. */
.hotspot .hotspot-number { opacity: 0; transition: opacity 0.15s; }
.hotspot:hover, .hotspot.active { transform: scale(1); z-index: 20; }
.hotspot:hover .hotspot-number, .hotspot.active .hotspot-number { opacity: 1; }
.hotspot.active::after, .hotspot:hover::after {
  content: attr(data-term);
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: rgba(20, 22, 26, 0.92);
  color: #e8e8e8;
  border: 1px solid #2c3038;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  pointer-events: none;
}
.hotspot.draft { background: var(--draft); }
.hotspot.active { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5); }
.hotspot.occlusion-aware:not([data-visible]) {
  opacity: 0;
  pointer-events: none;
}
.hotspot.occ-hidden { opacity: 0; pointer-events: none; }
.hotspot-number { pointer-events: none; }


.annotation-nav {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 56px;
}

.nav-arrow {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 14px;
  cursor: pointer;
  flex: 0 0 auto;
}

.annotation-nav-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.annotation-nav-hint { color: var(--muted); font-size: 0.85rem; }

.annotation-nav-counter { color: var(--muted); font-size: 0.75rem; margin-bottom: 2px; }

.annotation-nav-ru {
  font-size: 0.95rem;
  color: var(--text);
  overflow-wrap: break-word;
}

.annotation-nav-la {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
  overflow-wrap: break-word;
}

.hint { color: var(--muted); font-size: 0.8rem; margin-top: 8px; }
.empty { color: var(--muted); }
