:root {
  --bg: #080b0d;
  --bg-2: #101718;
  --surface: rgba(18, 25, 26, 0.88);
  --surface-strong: #151e20;
  --surface-soft: rgba(255, 255, 255, 0.035);
  --ink: #edf7f3;
  --muted: #94a7a2;
  --line: rgba(148, 163, 158, 0.26);
  --line-strong: rgba(73, 216, 189, 0.48);
  --accent: #37d6b1;
  --accent-dark: #139c85;
  --amber: #f0a43a;
  --danger: #e35d47;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(55, 214, 177, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(55, 214, 177, 0.04) 1px, transparent 1px),
    linear-gradient(150deg, rgba(55, 214, 177, 0.18), transparent 30rem),
    linear-gradient(25deg, rgba(240, 164, 58, 0.11), transparent 26rem),
    var(--bg);
  background-size: 44px 44px, 44px 44px, auto, auto, auto;
  color: var(--ink);
  font-family: "Bahnschrift", "Aptos", "Segoe UI", sans-serif;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(255, 255, 255, 0.035) 50%, transparent 50%);
  background-size: 100% 4px;
  opacity: 0.22;
  mix-blend-mode: overlay;
}

a {
  color: inherit;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 13, 0.86);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  color: var(--accent);
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.top-search {
  display: flex;
  gap: 0.5rem;
  min-width: min(33rem, 55vw);
}

.search-autocomplete {
  position: relative;
}

input,
button {
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
}

input {
  width: 100%;
  min-width: 0;
  padding: 0.78rem 0.9rem;
  background: rgba(4, 8, 9, 0.72);
  color: var(--ink);
  outline: none;
}

input::placeholder {
  color: #6f827d;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(55, 214, 177, 0.12);
}

button {
  padding: 0.78rem 1rem;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #03110f;
  border-color: var(--accent);
  cursor: pointer;
  font-weight: 800;
  text-transform: uppercase;
}

button:hover {
  filter: brightness(1.08);
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3.5rem) 0;
}

.site-footer {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0 0 2rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.4rem;
  padding: clamp(1.4rem, 5vw, 3rem);
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(135deg, rgba(55, 214, 177, 0.12), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent),
    var(--surface);
  box-shadow: var(--shadow);
  position: relative;
  overflow: visible;
}

.search-panel::after,
.blueprint-header::after {
  content: "";
  position: absolute;
  right: -4rem;
  bottom: -4rem;
  width: 18rem;
  height: 18rem;
  border: 1px solid rgba(55, 214, 177, 0.18);
  transform: rotate(18deg);
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  max-width: 800px;
  margin-bottom: 0;
  font-size: clamp(2.25rem, 6vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h3 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

h4 {
  margin-bottom: 0.55rem;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  max-width: 58rem;
}

.hero-search input {
  padding: 1rem;
  font-size: 1.05rem;
}

.suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  left: 0;
  z-index: 10;
  max-height: 22rem;
  overflow: auto;
  border: 1px solid var(--line-strong);
  background: #0d1415;
  box-shadow: var(--shadow);
}

.suggestions.is-open {
  display: grid;
}

.suggestions a {
  display: grid;
  gap: 0.1rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.suggestions a:last-child {
  border-bottom: 0;
}

.suggestions a:hover,
.suggestions a:focus {
  outline: none;
  background: rgba(55, 214, 177, 0.12);
}

.suggestions small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.results-section,
.detail-section,
.quick-links {
  margin-top: 1.25rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
}

.section-heading span {
  color: var(--amber);
  font-weight: 800;
}

.section-heading h2 {
  color: var(--ink);
}

.result-list,
.stack-list,
.material-list,
.system-groups,
.mission-groups {
  display: grid;
  gap: 0.65rem;
}

.rank-guide {
  display: grid;
  gap: 0.8rem;
  margin: -0.1rem 0 1rem;
  padding: 0.9rem;
  border: 1px solid rgba(55, 214, 177, 0.24);
  background:
    radial-gradient(circle at top left, rgba(55, 214, 177, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(255, 184, 92, 0.08), rgba(255, 255, 255, 0.02));
}

.rank-guide-copy {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1rem;
  text-align: center;
}

.rank-guide-copy strong {
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.86rem;
}

.rank-guide-copy span,
.rank-guide p {
  color: var(--muted);
  font-size: 0.88rem;
}

.rank-guide p {
  margin: 0;
}

.rank-guide b {
  color: var(--ink);
}

.rank-scale {
  display: grid;
  gap: 0.45rem;
}

.rank-scale ol {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--surface-soft);
  list-style: none;
  box-shadow:
    inset 0 0 28px rgba(0, 0, 0, 0.22),
    0 0 24px rgba(55, 214, 177, 0.08);
}

.rank-scale li {
  position: relative;
  display: grid;
  min-height: 3.1rem;
  place-items: center;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--rank-color), white 18%), var(--rank-color));
}

.rank-scale li + li {
  border-left: 1px solid rgba(5, 14, 15, 0.42);
}

.rank-scale li::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.24), transparent 42%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px 10px);
  mix-blend-mode: screen;
  pointer-events: none;
}

.rank-scale ol span {
  position: relative;
  z-index: 1;
  color: #07110f;
  font-size: 1.05rem;
  font-weight: 950;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.22);
}

.rank-scale-captions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: #f4fbf8;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rank-scale .rank-scale-captions span {
  color: #f4fbf8;
  border: 1px solid rgba(244, 251, 248, 0.22);
  background: rgba(3, 8, 10, 0.82);
  padding: 0.34rem 0.48rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.result-row,
.detail-section,
.material-block {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  text-decoration: none;
}

.result-row:hover {
  border-color: var(--accent);
  background: rgba(55, 214, 177, 0.08);
}

.result-row small,
.record-name,
.empty-state {
  color: var(--muted);
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.quick-links a {
  padding: 0.62rem 0.8rem;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--accent);
  text-decoration: none;
  text-transform: uppercase;
}

.quick-links a:hover {
  border-color: var(--accent);
}

.breadcrumb {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.blueprint-header {
  position: relative;
  overflow: hidden;
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(135deg, rgba(55, 214, 177, 0.10), transparent 52%),
    var(--surface);
  box-shadow: var(--shadow);
}

.record-name {
  margin: 0.75rem 0 0;
  overflow-wrap: anywhere;
}

.detail-grid {
  display: grid;
  gap: 1rem;
}

.detail-section {
  padding: 1rem;
}

.stack-list,
.material-block ul {
  margin: 0;
  padding-left: 1.1rem;
}

.system-group,
.mission-group {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.system-group {
  border-color: rgba(55, 214, 177, 0.22);
  background:
    linear-gradient(135deg, rgba(55, 214, 177, 0.07), transparent 42%),
    rgba(255, 255, 255, 0.025);
}

.system-group > summary,
.mission-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.78rem 0.9rem;
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
  list-style: none;
}

.system-group > summary {
  color: var(--ink);
  padding: 0.92rem 1rem;
  letter-spacing: 0.02em;
}

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

.system-group > summary::-webkit-details-marker {
  display: none;
}

.system-group > summary::before,
.mission-group summary::before {
  content: "+";
  color: var(--amber);
  font-weight: 900;
}

.system-group[open] > summary::before,
.mission-group[open] > summary::before {
  content: "-";
}

.system-group > summary span,
.mission-group summary span {
  flex: 1;
}

.system-group > summary small,
.mission-group summary small {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.system-group > .mission-groups {
  padding: 0 0.8rem 0.8rem;
}

.system-group .mission-group {
  background: rgba(0, 0, 0, 0.12);
}

.mission-group .stack-list {
  padding: 0 0.9rem 0.9rem 2.2rem;
}

.mission-line {
  color: var(--muted);
}

.mission-rank {
  color: var(--rank-color);
  font-weight: 900;
  text-shadow: 0 0 14px color-mix(in srgb, var(--rank-color), transparent 55%);
}

.mission-rank.rank-0 {
  --rank-color: #37d6b1;
}

.mission-rank.rank-1 {
  --rank-color: #58d68d;
}

.mission-rank.rank-2 {
  --rank-color: #a8d85c;
}

.mission-rank.rank-3 {
  --rank-color: #ffd166;
}

.mission-rank.rank-4 {
  --rank-color: #ff9f43;
}

.mission-rank.rank-5 {
  --rank-color: #ff6b6b;
}

.mission-rank.rank-6 {
  --rank-color: #c084fc;
}

.stack-list li,
.material-block li {
  margin-bottom: 0.3rem;
}

.material-block {
  padding: 1rem;
}

.material-block header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.material-block header span {
  color: var(--amber);
  font-weight: 900;
  white-space: nowrap;
}

.material-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding-top: 1rem;
}

@media (max-width: 760px) {
  .site-header,
  .result-row,
  .material-block header {
    align-items: stretch;
    flex-direction: column;
  }

  .top-search,
  .hero-search,
  .material-columns {
    grid-template-columns: 1fr;
  }

  .top-search {
    min-width: 0;
    width: 100%;
  }

  h1 {
    font-size: 2.35rem;
  }
}
