:root {
  --bg: #05060a;
  --fg: #e8ecf4;
  --fg-strong: #f4f7fb;
  --accent: #f0b429;
  --blue: #8fb8ff;
  --panel: rgba(10, 13, 20, .62);
  --hairline: rgba(150, 180, 220, .12);
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Space Grotesk", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); overflow: hidden; }
body { font-family: var(--sans); color: var(--fg); -webkit-font-smoothing: antialiased; }
a { color: #6ee7c0; text-decoration: none; }
a:hover { color: #a7f3d6; }
::selection { background: rgba(110, 231, 192, .25); }

.stage { position: relative; width: 100vw; height: 100vh; overflow: hidden; }
#cosmos { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, rgba(0,0,0,0) 40%, rgba(3,4,8,.75) 100%);
}

/* ---------- top bar ---------- */
.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: clamp(18px, 3.4vh, 38px) clamp(24px, 3vw, 44px);
  pointer-events: none;
}
.intro { max-width: 430px; }
.eyebrow { display: flex; align-items: center; gap: 14px; margin-bottom: clamp(10px, 2.2vh, 22px); }
.eyebrow .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px 2px rgba(240,180,41,.6); }
.eyebrow .kicker { font-family: var(--mono); font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); }
.eyebrow .rule { flex: 1; height: 1px; background: linear-gradient(90deg, rgba(240,180,41,.45), rgba(240,180,41,0)); }

.topbar h1 {
  margin: 0; font-size: clamp(26px, 5.2vh, 44px); line-height: 1.03; font-weight: 500;
  letter-spacing: -.028em; color: var(--fg-strong); text-wrap: balance;
}
.topbar h1 .amp { color: var(--blue); }
.topbar p {
  margin: clamp(10px, 2vh, 20px) 0 0; max-width: 360px;
  font-size: clamp(11.5px, 2.2vh, 14.5px); line-height: 1.6; color: rgba(220,230,245,.58); text-wrap: pretty;
}

.topright { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; pointer-events: auto; }
.counts {
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: rgba(200,215,235,.42);
}
.counts .dim { color: rgba(200,215,235,.25); }

.searchwrap { position: relative; width: 250px; }
.searchbox {
  display: flex; align-items: center; gap: 9px; padding: 9px 13px; border-radius: 11px;
  background: var(--panel); border: 1px solid rgba(150,180,220,.14);
  backdrop-filter: blur(18px); box-shadow: 0 18px 44px -18px rgba(0,0,0,.8);
}
.searchbox .ring { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid rgba(200,215,235,.4); flex: none; }
.searchbox input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--fg-strong);
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em;
}
.searchbox input::placeholder { color: rgba(200,215,235,.38); }
.searchbox .clear { cursor: pointer; font-size: 14px; line-height: 1; color: rgba(200,215,235,.35); }
.searchbox .clear:hover { color: var(--fg); }

.results {
  position: absolute; top: 46px; right: 0; left: 0; padding: 6px; border-radius: 11px;
  background: rgba(8,11,18,.86); border: 1px solid rgba(150,180,220,.14);
  backdrop-filter: blur(20px); box-shadow: 0 24px 56px -18px rgba(0,0,0,.9);
  display: flex; flex-direction: column; gap: 1px;
}
.result { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px; cursor: pointer; }
.result:hover { background: rgba(150,180,220,.09); }
.result .swatch { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.result .name { flex: 1; font-size: 12px; color: rgba(240,244,251,.9); }
.result .tag { font-family: var(--mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: rgba(200,215,235,.32); }

/* ---------- panels ---------- */
.panel {
  position: absolute; border-radius: 16px; background: var(--panel);
  border: 1px solid var(--hairline); backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.8);
}
.strata {
  left: clamp(24px, 3vw, 44px); bottom: clamp(96px, 13vh, 124px);
  width: clamp(206px, 20vw, 262px);
  padding: clamp(11px, 2.1vh, 18px) 16px clamp(9px, 1.6vh, 14px);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(200,215,235,.42);
  padding-bottom: clamp(7px, 1.5vh, 12px); margin-bottom: clamp(5px, 1.2vh, 10px);
  border-bottom: 1px solid rgba(150,180,220,.1);
}
.panel-head .all { cursor: pointer; }
.panel-head .all:hover { color: var(--fg); }
.panel-head .all.active { color: var(--accent); }

.strata-list {
  display: flex; flex-direction: column; gap: 1px; padding: 0 8px; margin: 0 -8px;
  max-height: min(42vh, calc(100vh - 400px)); overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: rgba(150,180,220,.28) transparent;
}
.stratum {
  display: flex; align-items: center; gap: 10px; padding: clamp(2px, .75vh, 6px) 8px; margin: 0 -8px;
  border-radius: 8px; cursor: pointer; transition: opacity .2s var(--ease), background .2s var(--ease);
}
.stratum:hover { background: rgba(150,180,220,.08); }
.stratum.dimmed { opacity: .34; }
.stratum .swatch { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.stratum .name { flex: 1; font-size: clamp(10.5px, 2vh, 12.5px); font-weight: 500; color: rgba(232,236,244,.9); }
.stratum .count { font-family: var(--mono); font-size: 10.5px; color: rgba(200,215,235,.38); }

.detail { right: 44px; bottom: 112px; width: 280px; padding: 18px; }
.detail-head { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.detail-head .swatch { width: 8px; height: 8px; border-radius: 50%; }
.detail-head .stratum-name { font-family: var(--mono); font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: rgba(200,215,235,.5); }
.detail-head .close { margin-left: auto; cursor: pointer; font-size: 14px; line-height: 1; color: rgba(200,215,235,.35); }
.detail-head .close:hover { color: var(--fg); }
.detail .title { font-size: 20px; font-weight: 500; letter-spacing: -.02em; color: var(--fg-strong); }
.detail .fields {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(150,180,220,.1);
  display: flex; flex-direction: column; gap: 3px; max-height: 150px; overflow: auto;
}
.detail .fields div { font-family: var(--mono); font-size: 10.5px; letter-spacing: .02em; color: rgba(210,222,240,.62); }
.detail .degree {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(150,180,220,.1); margin-bottom: 10px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: rgba(200,215,235,.38);
}
.detail .neighbors { display: flex; flex-wrap: wrap; gap: 6px; }
.detail .neighbors span {
  padding: 4px 9px; border-radius: 999px; font-size: 11px; color: rgba(232,236,244,.78);
  background: rgba(150,180,220,.08); border: 1px solid rgba(150,180,220,.12);
}

/* ---------- bottom bar ---------- */
.bottombar {
  position: absolute; left: 0; right: 0; bottom: clamp(14px, 3.4vh, 38px);
  display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.6vh, 14px);
}
.controls {
  display: flex; gap: 4px; padding: 5px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--hairline);
  backdrop-filter: blur(18px); box-shadow: 0 18px 44px -16px rgba(0,0,0,.8);
}
.controls button {
  appearance: none; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(212,224,242,.62); background: transparent; border: 1px solid transparent;
  transition: all .18s var(--ease);
}
.controls button:hover { color: var(--fg); }
.controls button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.controls button.active { color: #08111a; background: var(--accent); border-color: var(--accent); }
.hint {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(200,215,235,.24);
}

@media (max-width: 900px) {
  .topbar p, .strata, .detail { display: none; }
}
