* { box-sizing: border-box; }

:root {
  --bg: #0b0d10;
  --panel-bg: #14171c;
  --border: #2a2f37;
  --text: #e8e8e8;
  --muted: #8a8f98;
  --accent: #ffd23f;
  --enzyme-inactive: #4a4f57;
  --enzyme-active: #ffd23f;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#app-header {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
#app-header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.25rem;
}
.scope-tag {
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}
.instructions {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 70ch;
}
.sample-enzyme {
  color: var(--accent);
  font-weight: bold;
}

#layout {
  display: flex;
  height: calc(100vh - 78px);
}

#viewer {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #000;
  cursor: grab;
}
#viewer.dragging { cursor: grabbing; }

#pan-zoom-target {
  transform-origin: 0 0;
  width: 0;
  height: 0;
}

#board-container svg {
  display: block;
}

#zoom-controls {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
#zoom-controls button {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-bg);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}
#zoom-controls button:hover { background: #1c2027; }
#zoom-reset { width: auto; font-size: 0.75rem; padding: 0 0.5rem; }

#sidebar {
  width: 300px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--panel-bg);
  padding: 1rem;
  overflow-y: auto;
}
#sidebar h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 1.25rem 0 0.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#sidebar h2:first-child { margin-top: 0; }
#sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
}
#sidebar li {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
  border-bottom: 1px dotted var(--border);
}
#sidebar .count {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
#toggle-debug {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
}

/* --- SVG element states --- */
text.enzyme-label {
  transition: fill 120ms ease, opacity 120ms ease;
}
text.enzyme-inactive {
  fill: var(--enzyme-inactive) !important;
  opacity: 0.55;
}
text.enzyme-active {
  fill: var(--enzyme-active) !important;
  font-weight: bold;
}

circle.enzyme-hit {
  fill: transparent;
  stroke: none;
  pointer-events: all;
}
circle.enzyme-hit.enzyme-active {
  cursor: pointer;
}
circle.enzyme-hit.enzyme-active:hover {
  fill: rgba(255, 210, 63, 0.18);
}
circle.enzyme-hit.enzyme-inactive {
  cursor: not-allowed;
}

text.compound-label {
  transition: fill 120ms ease, opacity 120ms ease;
}
text.compound-label.empty {
  opacity: 0.35;
}
text.compound-label.has-tokens {
  font-weight: bold;
}
