:root {
  color-scheme: dark;
  --bg: #1b1d21;
  --fg: #e8e6e3;
  --muted: #9a9890;
  --panel: rgba(27, 29, 33, 0.82);
  --filled: #9fb7d6;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.4 system-ui, sans-serif;
}

#view {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#panel,
#views,
#info {
  position: fixed;
  background: var(--panel);
  border-radius: 8px;
}

#panel {
  top: 12px;
  left: 12px;
  width: min(300px, calc(100vw - 24px));
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding: 6px;
}

#panel summary {
  padding: 4px 6px;
  cursor: pointer;
}

#layers > summary {
  font-weight: 600;
}

.group > summary {
  display: flex;
  gap: 6px;
  align-items: center;
}

.group .count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.group ul {
  margin: 0 0 4px;
  padding: 0 0 0 22px;
  list-style: none;
}

.group li {
  display: flex;
  gap: 4px;
  align-items: center;
}

.group li button {
  padding: 2px 6px;
  text-align: left;
}

.group li button.plain,
.group.structure li button {
  color: var(--filled);
}

.group.scans > summary {
  color: var(--muted);
  font-style: italic;
}

#views {
  top: 12px;
  right: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  max-width: calc(100vw - 24px);
  padding: 6px;
}

#view-label {
  min-width: 9em;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

#info {
  right: 12px;
  bottom: 40px;
  width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
}

#info h2 {
  margin: 0 24px 4px 0;
  font-size: 16px;
}

#info p {
  margin: 4px 0;
}

#info p:empty {
  display: none;
}

#info-group {
  color: var(--muted);
}

#info-close {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 2px 8px;
}

button {
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}

button:hover {
  border-color: var(--muted);
}

@media (max-width: 640px) {
  #views {
    top: auto;
    bottom: 40px;
    left: 12px;
    right: 12px;
  }

  #info {
    bottom: 100px;
  }

  #help {
    display: none;
  }
}

#status,
#help {
  position: fixed;
  left: 12px;
  margin: 0;
  color: var(--muted);
  pointer-events: none;
}

#status {
  bottom: 36px;
}

#status:empty {
  display: none;
}

#help {
  bottom: 12px;
  font-size: 12px;
}
