:root {
  --bg: #0c0c0f;
  --border: #1e1e28;
  --text: #c8c4bc;
  --muted: #5a5660;
  --accent: #c8a96e;
  --cell: 18px;
  --label-w: 210px;
  --header-h: 130px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  min-height: 100vh;
}
header {
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
}
header h1 {
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
#meta { color: var(--muted); font-size: 11px; white-space: nowrap; }
.legend {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.legend-null {
  width: 14px; height: 14px; flex-shrink: 0;
  background: repeating-linear-gradient(45deg,#1a1a22 0,#1a1a22 2px,#0c0c10 2px,#0c0c10 4px);
  border: 1px solid #2a2a35;
}
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: calc(100vh - 62px);
  gap: 16px;
  color: var(--muted);
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#scroll-wrap {
  overflow: auto;
  height: calc(100vh - 62px);
  display: none;
}
table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
th.token-head, td.token-name {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--bg);
  width: var(--label-w);
  min-width: var(--label-w);
  max-width: var(--label-w);
  padding: 0 8px 0 14px;
  height: var(--cell);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  color: var(--muted);
  border-right: 2px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
th.token-head {
  position: sticky;
  top: 0; left: 0;
  z-index: 10;
  background: var(--bg);
  height: var(--header-h);
  vertical-align: bottom;
  padding-bottom: 6px;
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
}
th.style-head {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--bg);
  width: var(--cell);
  min-width: var(--cell);
  max-width: var(--cell);
  height: var(--header-h);
  padding: 0;
  border-bottom: 2px solid var(--border);
  vertical-align: bottom;
}
th.style-head .rotated {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.03em;
  padding: 4px 4px 2px;
  display: block;
  transition: color 0.12s;
}
th.style-head:hover .rotated { color: var(--text); }
th.style-head .bg-strip {
  width: var(--cell);
  height: 5px;
  display: block;
  margin-top: 1px;
}
td.color-cell {
  width: var(--cell);
  min-width: var(--cell);
  max-width: var(--cell);
  height: var(--cell);
  padding: 1px;
  position: relative;
  cursor: default;
}
td.color-cell .swatch,
td.color-cell .null-swatch {
  width: 100%; height: 100%;
  display: block;
}
td.color-cell .null-swatch {
  background: repeating-linear-gradient(
    45deg,#161620 0,#161620 2px,#0e0e15 2px,#0e0e15 4px
  );
}
td.color-cell::after {
  content: attr(data-hex);
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  background: #1c1c26;
  color: var(--text);
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  padding: 2px 5px;
  border: 1px solid var(--border);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 200;
  transition: opacity 0.08s;
}
td.color-cell:hover::after { opacity: 1; }
td.color-cell:hover .swatch,
td.color-cell:hover .null-swatch {
  outline: 2px solid rgba(200,169,110,0.8);
  outline-offset: -1px;
}
tr:nth-child(even) td.token-name {
  background: color-mix(in srgb, var(--bg) 93%, white 7%);
}
tr:nth-child(even) td.color-cell {
  background: rgba(255,255,255,0.015);
}
tr.group-sep td { border-top: 1px solid #22222e; }
td.token-name.group-label {
  color: #8a7a5e;
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
