:root {
  --bg0: #07080a;
  --bg1: #0c0f14;
  --ink: #e9e7e2;
  --muted: rgba(233, 231, 226, 0.62);
  --faint: rgba(233, 231, 226, 0.18);

  --acid: #59f6c8;
  --acid2: #4aa7ff;
  --warn: #ffbe5c;
  --bad: #ff5b7a;
  --ok: #59f6c8;

  --card: rgba(12, 15, 20, 0.65);
  --card2: rgba(8, 10, 14, 0.65);
  --stroke: rgba(233, 231, 226, 0.12);
  --stroke2: rgba(89, 246, 200, 0.22);
  --shadow: rgba(0, 0, 0, 0.55);

  --r: 18px;
  --r2: 26px;

  --title: "Unbounded", system-ui, -apple-system, Segoe UI, sans-serif;
  --body: "Recursive", ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--body);
  font-variation-settings: "CASL" 0.2, "CRSV" 0.3, "slnt" -8, "MONO" 0.08;
  letter-spacing: 0.2px;
  color: var(--ink);
  background: radial-gradient(1200px 900px at 15% 10%, rgba(89, 246, 200, 0.18), transparent 60%),
    radial-gradient(900px 600px at 85% 15%, rgba(74, 167, 255, 0.18), transparent 55%),
    radial-gradient(1000px 800px at 50% 110%, rgba(255, 91, 122, 0.12), transparent 58%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 55%, #06070a);
  overflow: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  transform: translateZ(0);
}

.scanline {
  position: fixed;
  inset: -30%;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(89, 246, 200, 0.08) 45%,
    rgba(89, 246, 200, 0.14) 50%,
    rgba(89, 246, 200, 0.08) 55%,
    transparent 100%
  );
  opacity: 0.25;
  animation: scan 9s linear infinite;
}

@keyframes scan {
  0% {
    transform: translateY(-35%);
  }
  100% {
    transform: translateY(35%);
  }
}

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid rgba(233, 231, 226, 0.08);
  background: linear-gradient(180deg, rgba(10, 12, 16, 0.92), rgba(10, 12, 16, 0.55));
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand__mark {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  position: relative;
  background: radial-gradient(circle at 30% 30%, rgba(89, 246, 200, 0.35), transparent 60%),
    radial-gradient(circle at 70% 40%, rgba(74, 167, 255, 0.32), transparent 62%),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(233, 231, 226, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.mark__dot {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--acid);
  box-shadow: 0 0 0 6px rgba(89, 246, 200, 0.16), 0 0 30px rgba(89, 246, 200, 0.45);
}

.mark__ring {
  position: absolute;
  inset: 10px;
  border-radius: 999px;
  border: 1px dashed rgba(233, 231, 226, 0.28);
  animation: spin 14s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.brand__title {
  font-family: var(--title);
  letter-spacing: 0.5px;
  font-weight: 700;
  font-size: 16px;
}

.brand__subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.4px;
}

.topbar__meta {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chip {
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(233, 231, 226, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(233, 231, 226, 0.85);
  font-size: 12px;
  letter-spacing: 0.2px;
}

.chip--pulse {
  border-color: rgba(89, 246, 200, 0.35);
  color: rgba(89, 246, 200, 0.95);
  box-shadow: 0 0 0 0 rgba(89, 246, 200, 0.3);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(89, 246, 200, 0.25);
  }
  65% {
    box-shadow: 0 0 0 10px rgba(89, 246, 200, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(89, 246, 200, 0);
  }
}

.layout {
  height: calc(100% - 76px);
  display: grid;
  grid-template-columns: 250px 1fr;
}

.nav {
  border-right: 1px solid rgba(233, 231, 226, 0.08);
  padding: 16px 12px;
  background: linear-gradient(180deg, rgba(10, 12, 16, 0.7), rgba(10, 12, 16, 0.35));
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.nav__item {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 12px;
  border-radius: 14px;
  color: rgba(233, 231, 226, 0.86);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: 0.3px;
  text-align: left;
}

.nav__glyph {
  width: 26px;
  height: 26px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(233, 231, 226, 0.08);
  color: rgba(233, 231, 226, 0.8);
}

.nav__item:hover {
  border-color: rgba(233, 231, 226, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.nav__item.is-active {
  border-color: rgba(89, 246, 200, 0.32);
  background: radial-gradient(circle at 20% 0%, rgba(89, 246, 200, 0.16), transparent 60%),
    rgba(255, 255, 255, 0.03);
}

.nav__item.is-active .nav__glyph {
  border-color: rgba(89, 246, 200, 0.28);
  color: rgba(89, 246, 200, 0.95);
}

.nav__footer {
  margin-top: 18px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(233, 231, 226, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.nav__hint {
  font-size: 11px;
  color: var(--muted);
}

.nav__link {
  margin-top: 8px;
  display: inline-block;
  font-size: 12px;
  color: rgba(89, 246, 200, 0.95);
  text-decoration: none;
}
.nav__link:hover {
  text-decoration: underline;
}

.view {
  overflow: auto;
  padding: 18px 18px 30px 18px;
}

.view__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 6px 4px 14px 4px;
}

.view__title {
  font-family: var(--title);
  font-size: 20px;
  letter-spacing: 0.6px;
}

.view__actions {
  display: flex;
  gap: 10px;
}

.panel {
  display: none;
}
.panel.is-active {
  display: block;
}

.grid {
  display: grid;
  gap: 14px;
}
.grid--2 {
  grid-template-columns: 1fr 1fr;
}
.grid--3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.card {
  border-radius: var(--r2);
  padding: 16px 16px;
  background: radial-gradient(circle at 18% 0%, rgba(89, 246, 200, 0.08), transparent 55%),
    radial-gradient(circle at 88% 10%, rgba(74, 167, 255, 0.08), transparent 55%),
    linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid var(--stroke);
  box-shadow: 0 14px 60px var(--shadow);
}

.card--wide {
  margin-top: 14px;
}

.card__kicker {
  font-size: 12px;
  color: rgba(233, 231, 226, 0.6);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.card__title {
  margin-top: 8px;
  font-family: var(--title);
  font-size: 18px;
  letter-spacing: 0.4px;
}

.card__meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.instances {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.instance {
  border-radius: 18px;
  padding: 14px 14px;
  border: 1px solid rgba(233, 231, 226, 0.1);
  background: rgba(255, 255, 255, 0.02);
}

.instance__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.instance__name {
  font-family: var(--title);
  font-size: 14px;
  letter-spacing: 0.4px;
}

.badge {
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(233, 231, 226, 0.14);
  color: rgba(233, 231, 226, 0.82);
  background: rgba(255, 255, 255, 0.03);
}
.badge--ok {
  border-color: rgba(89, 246, 200, 0.32);
  color: rgba(89, 246, 200, 0.95);
}
.badge--bad {
  border-color: rgba(255, 91, 122, 0.32);
  color: rgba(255, 91, 122, 0.92);
}
.badge--warn {
  border-color: rgba(255, 190, 92, 0.35);
  color: rgba(255, 190, 92, 0.95);
}

.instance__meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.module-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.module {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(233, 231, 226, 0.1);
  background: rgba(255, 255, 255, 0.02);
}
.module__name {
  font-size: 13px;
  color: rgba(233, 231, 226, 0.88);
}
.module__meta {
  font-size: 12px;
  color: var(--muted);
}

.control {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.input,
.select {
  border-radius: 14px;
  border: 1px solid rgba(233, 231, 226, 0.12);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(233, 231, 226, 0.92);
  padding: 10px 12px;
  outline: none;
  font-size: 13px;
}

.input::placeholder {
  color: rgba(233, 231, 226, 0.4);
}

.input--small {
  width: 90px;
}

.input--mid {
  width: 170px;
}

.btn {
  border-radius: 14px;
  border: 1px solid rgba(89, 246, 200, 0.32);
  background: rgba(89, 246, 200, 0.08);
  color: rgba(89, 246, 200, 0.96);
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover {
  background: rgba(89, 246, 200, 0.12);
}
.btn--ghost {
  border-color: rgba(233, 231, 226, 0.18);
  background: rgba(255, 255, 255, 0.02);
  color: rgba(233, 231, 226, 0.86);
}
.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.04);
}

.btn--toggle.is-on {
  border-color: rgba(255, 190, 92, 0.32);
  background: rgba(255, 190, 92, 0.08);
  color: rgba(255, 190, 92, 0.95);
}

.table {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(233, 231, 226, 0.1);
  background: rgba(0, 0, 0, 0.18);
}

.row {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(233, 231, 226, 0.06);
  font-size: 12px;
  color: rgba(233, 231, 226, 0.84);
}

.row--head {
  background: rgba(255, 255, 255, 0.03);
  color: rgba(233, 231, 226, 0.72);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-size: 11px;
}

.row:last-child {
  border-bottom: none;
}

.row__mono {
  font-variation-settings: "MONO" 1;
  font-family: var(--body);
  letter-spacing: 0.2px;
  color: rgba(233, 231, 226, 0.76);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__pill {
  justify-self: end;
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid rgba(233, 231, 226, 0.14);
  color: rgba(233, 231, 226, 0.82);
  background: rgba(255, 255, 255, 0.02);
}

.row__pill.ok {
  border-color: rgba(89, 246, 200, 0.3);
  color: rgba(89, 246, 200, 0.95);
}
.row__pill.bad {
  border-color: rgba(255, 91, 122, 0.3);
  color: rgba(255, 91, 122, 0.92);
}
.row__pill.warn {
  border-color: rgba(255, 190, 92, 0.35);
  color: rgba(255, 190, 92, 0.94);
}

.row.is-click {
  cursor: pointer;
}
.row.is-click:hover {
  background: rgba(255, 255, 255, 0.035);
}

.viewer {
  margin: 0;
  height: 884px;
  overflow: auto;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(233, 231, 226, 0.1);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(233, 231, 226, 0.86);
  font-size: 12px;
  line-height: 1.55;
  font-variation-settings: "MONO" 1, "CASL" 0;
  white-space: pre-wrap;
}

#ak-viewer {
  height: 900px;
}

#ak-meta {
  height: 350px;
}

#ak-opt-viewer {
  height: 900px;
}

#ak-opt-meta {
  height: 220px;
  overflow: auto;
}

.mono {
  margin-top: 10px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(233, 231, 226, 0.1);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(233, 231, 226, 0.86);
  font-size: 12px;
  line-height: 1.6;
  font-variation-settings: "MONO" 1, "CASL" 0;
  white-space: pre-wrap;
}

.stats {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr 1fr;
}

.stat {
  border-radius: 18px;
  padding: 12px 12px;
  border: 1px solid rgba(233, 231, 226, 0.1);
  background: radial-gradient(circle at 18% 0%, rgba(89, 246, 200, 0.1), transparent 62%),
    radial-gradient(circle at 88% 10%, rgba(74, 167, 255, 0.08), transparent 62%), rgba(255, 255, 255, 0.02);
}

.stat__label {
  font-size: 11px;
  color: rgba(233, 231, 226, 0.62);
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.stat__value {
  margin-top: 6px;
  font-family: var(--title);
  font-size: 16px;
  letter-spacing: 0.4px;
}

.stat__hint {
  margin-top: 4px;
  color: rgba(233, 231, 226, 0.68);
  font-size: 12px;
  font-variation-settings: "MONO" 1, "CASL" 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat--ok {
  border-color: rgba(89, 246, 200, 0.22);
}

.stat--warn {
  border-color: rgba(255, 190, 92, 0.24);
}

.stat--bad {
  border-color: rgba(255, 91, 122, 0.22);
}

.gloss {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.gloss__item {
  border-radius: 18px;
  border: 1px solid rgba(233, 231, 226, 0.1);
  background: rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.gloss__item summary {
  cursor: pointer;
  padding: 12px 12px;
  list-style: none;
  user-select: none;
  color: rgba(233, 231, 226, 0.9);
  font-size: 13px;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.gloss__item summary::-webkit-details-marker {
  display: none;
}

.gloss__item summary::after {
  content: "+";
  width: 26px;
  height: 26px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(233, 231, 226, 0.14);
  background: rgba(255, 255, 255, 0.02);
  color: rgba(233, 231, 226, 0.7);
  flex: 0 0 auto;
}

.gloss__item[open] summary::after {
  content: "—";
  border-color: rgba(89, 246, 200, 0.25);
  color: rgba(89, 246, 200, 0.92);
}

.gloss__body {
  padding: 0 12px 12px 12px;
  color: rgba(233, 231, 226, 0.76);
  font-size: 12px;
  line-height: 1.6;
  font-variation-settings: "MONO" 0.2, "CASL" 0.1;
}

.gloss__p {
  margin-top: 8px;
}

.gloss__term {
  color: rgba(233, 231, 226, 0.92);
  font-variation-settings: "MONO" 0.8, "CASL" 0;
}

.gloss__tags {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(233, 231, 226, 0.14);
  background: rgba(255, 255, 255, 0.02);
  padding: 4px 8px;
  font-size: 11px;
  color: rgba(233, 231, 226, 0.78);
  letter-spacing: 0.3px;
}

.tag--warn {
  border-color: rgba(255, 190, 92, 0.28);
  color: rgba(255, 190, 92, 0.95);
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .nav {
    display: none;
  }
  .grid--2,
  .grid--3,
  .stats,
  .instances {
    grid-template-columns: 1fr;
  }
  .viewer {
    height: 714px;
  }
}
