/* Minimal, compact table design with accessible tooltips */
:root {
  --bg: #0e1116;
  --panel: #161a22;
  --ink: #e9eef3;
  --muted: #a6b0bf;
  --accent: #6aa3ff;
  --border: #232a36;
  --good: #2ecc71;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial;
}
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}
h1 {
  font-size: 20px;
  margin: 8px 0 4px;
}
.subtle {
  color: var(--muted);
  margin: 0 0 8px;
}
.note {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  margin: 8px 0;
}
.note summary {
  cursor: pointer;
  color: var(--accent);
}
pre {
  background: #0b0e13;
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: 8px;
  overflow: auto;
}

/* inner wrapper should not clip tooltips/popups */
.table-wrapper {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  overflow: visible; /* allow popups outside */
  position: relative; /* ensure absolute popups position correctly */
}
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 900px;
}
thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  text-align: left;
  font-weight: 600;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:hover {
  background: #141925;
}

code,
kbd {
  background: #0b0e13;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 6px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #10141b;
  color: var(--ink);
}
.badge.good {
  border-color: #214d33;
  background: #0c2216;
  color: #c9f7dd;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.info-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}
.info-icon {
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
}
.info-icon::after {
  content: "ⓘ";
  font-size: 12px;
  line-height: 1;
}

.tooltip {
  position: relative;
}

/* wrap for horizontal scrolling only */
.table-scroll {
  overflow-x: auto;
}

.mut-pop {
  display: none;
  position: absolute;
  top: 100%; /* directly below icon */
  left: 0;
  margin-top: 6px;
  z-index: 20;
  background: #0b0e13;
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 10px;
  width: 300px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.mut-pop h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}
.mut-pop ul {
  margin: 0 0 6px 16px;
  padding: 0;
}
.mut-pop li {
  margin: 2px 0;
}

.info-cell {
  position: relative;
}
.info-cell.show .mut-pop {
  display: block;
}

.footer {
  color: var(--muted);
  font-size: 12px;
}

/* Global mutation overlay that lives outside the table */
#mut-overlay {
  position: fixed;
  display: none;
  z-index: 9999;
  max-width: 320px;
  background: #0b0e13;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
#mut-overlay.show {
  display: block;
}
#mut-overlay h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}
#mut-overlay ul {
  margin: 0 0 6px 16px;
  padding: 0;
}
#mut-overlay li {
  margin: 2px 0;
}

/* Global header tooltip overlay (fixed, outside table) */
#th-tip {
  position: fixed;
  display: none;
  z-index: 9998;
  max-width: 320px;
  background: #0b0e13;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
#th-tip.show {
  display: block;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable::after {
  content: "";
  margin-left: 6px;
  font-size: 10px;
  opacity: 0.6;
}
th.sortable[data-sort="asc"]::after {
  content: "▲";
}
th.sortable[data-sort="desc"]::after {
  content: "▼";
}
th.sortable[data-sort="none"]::after {
  content: "";
}

/* optional: tidy up the Type column */
td.diet-cell,
th.info-cell {
  text-align: center;
  width: 44px;
}
