:root {
  color-scheme: dark;
  --bg: #05070b;
  --panel: rgba(13, 19, 30, 0.82);
  --panel-strong: #0c1320;
  --line: rgba(138, 161, 189, 0.2);
  --text: #edf7ff;
  --muted: #8fa0b8;
  --cyan: #31e7ff;
  --green: #55f2a4;
  --amber: #ffcc66;
  --pink: #ff4fd8;
  --blue: #637bff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 19% 12%, rgba(49, 231, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 82% 24%, rgba(255, 79, 216, 0.12), transparent 24rem),
    linear-gradient(145deg, #05070b 0%, #09101a 52%, #06080e 100%);
  color: var(--text);
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.orbital-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 20%, black, transparent 72%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2.5rem);
  backdrop-filter: blur(22px);
  background: rgba(5, 7, 11, 0.72);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  aspect-ratio: 1;
  border: 1px solid rgba(49, 231, 255, 0.55);
  background: linear-gradient(135deg, rgba(49, 231, 255, 0.2), rgba(99, 123, 255, 0.24));
  box-shadow: 0 0 30px rgba(49, 231, 255, 0.24);
  font-weight: 900;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.topbar nav a,
.rail-header p,
.stage-header p,
.intelligence-band > div > p,
.pipeline-copy > p:first-child {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar nav {
  display: flex;
  gap: 1.5rem;
}

.topbar nav a {
  color: #bfd0e6;
  text-decoration: none;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.65rem;
  padding: 0 1rem;
  border: 1px solid rgba(49, 231, 255, 0.35);
  background: rgba(49, 231, 255, 0.08);
  color: var(--text);
}

main {
  padding: clamp(1rem, 3vw, 2.5rem);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(18rem, 23rem) minmax(0, 1fr);
  gap: 1rem;
  min-height: calc(100vh - 6.5rem);
}

.control-rail,
.results-stage,
.intelligence-band,
.pipeline {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-rail {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
}

.rail-header h1 {
  margin: 0.45rem 0 0;
  font-size: clamp(2.35rem, 5vw, 4.85rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.field {
  display: grid;
  gap: 0.55rem;
}

.field span {
  color: #c9d8ea;
  font-size: 0.86rem;
  font-weight: 700;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  min-height: 3rem;
  padding: 0 0.9rem;
  border: 1px solid rgba(143, 160, 184, 0.28);
  background: #070c14;
  color: var(--text);
}

input[type="range"] {
  accent-color: var(--cyan);
}

output {
  color: var(--green);
  font-weight: 800;
}

.toggle-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.toggle {
  min-height: 2.45rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #aebed2;
}

.toggle.active {
  border-color: rgba(85, 242, 164, 0.55);
  background: rgba(85, 242, 164, 0.12);
  color: var(--text);
}

.source-meter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: auto;
}

.source-meter div {
  padding: 1rem;
  border: 1px solid rgba(143, 160, 184, 0.2);
  background: rgba(255, 255, 255, 0.04);
}

.source-meter strong {
  display: block;
  color: var(--cyan);
  font-size: 1.7rem;
}

.source-meter span {
  color: var(--muted);
  font-size: 0.78rem;
}

.results-stage {
  display: grid;
  grid-template-rows: auto minmax(17rem, 0.78fr) auto;
  gap: 1rem;
  padding: 1rem;
  overflow: hidden;
}

.stage-header,
.intelligence-band,
.pipeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.stage-header h2,
.intelligence-band h2,
.pipeline h2 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.55rem, 3vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.scan-status {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(85, 242, 164, 0.26);
  color: #dfffee;
  background: rgba(85, 242, 164, 0.08);
  font-size: 0.88rem;
}

.scan-status span {
  width: 0.55rem;
  aspect-ratio: 1;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 18px var(--green);
}

.map-panel {
  position: relative;
  min-height: 20rem;
  overflow: hidden;
  border: 1px solid rgba(49, 231, 255, 0.16);
  background:
    linear-gradient(135deg, rgba(49, 231, 255, 0.08), transparent 30%),
    url("https://images.unsplash.com/photo-1604580864964-0462f5d5b1a8?auto=format&fit=crop&w=1600&q=75") center/cover;
  isolation: isolate;
}

.map-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(5, 7, 11, 0.88), rgba(5, 7, 11, 0.36));
}

.lake {
  position: absolute;
  top: -10%;
  left: 0;
  width: 70%;
  height: 34%;
  transform: skewX(-18deg);
  background: linear-gradient(90deg, rgba(49, 231, 255, 0.45), rgba(49, 231, 255, 0.02));
  filter: blur(1px);
}

.corridor {
  position: absolute;
  left: 22%;
  top: 52%;
  width: 54%;
  height: 0.22rem;
  transform: rotate(12deg);
  background: linear-gradient(90deg, transparent, var(--cyan), var(--pink), transparent);
  box-shadow: 0 0 28px rgba(49, 231, 255, 0.5);
}

.map-pin {
  position: absolute;
  left: var(--x);
  top: var(--y);
  translate: -50% -50%;
  width: 4.2rem;
  aspect-ratio: 1;
  border-radius: 999px;
  border: 1px solid rgba(49, 231, 255, 0.65);
  background: rgba(5, 10, 18, 0.78);
  color: var(--text);
  box-shadow: 0 0 35px rgba(49, 231, 255, 0.28);
}

.map-pin.active {
  border-color: var(--green);
  box-shadow: 0 0 45px rgba(85, 242, 164, 0.45);
}

.map-pin span {
  font-weight: 900;
}

.map-label {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  margin: 0;
  color: #d9e8f8;
  font-weight: 800;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.listing-card {
  display: grid;
  gap: 0.8rem;
  padding: 0.85rem;
  border: 1px solid rgba(143, 160, 184, 0.2);
  background: rgba(8, 13, 22, 0.86);
}

.listing-card.selected {
  border-color: rgba(85, 242, 164, 0.55);
}

.listing-photo {
  min-height: 8rem;
  background: var(--photo) center/cover;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.listing-topline,
.listing-meta,
.freshness {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.listing-topline h3 {
  margin: 0;
  font-size: 1rem;
}

.price {
  color: var(--green);
  font-weight: 900;
  white-space: nowrap;
}

.listing-meta,
.freshness,
.listing-card p {
  color: var(--muted);
  font-size: 0.83rem;
}

.listing-card p {
  margin: 0;
}

.confidence {
  color: var(--cyan);
  font-weight: 800;
}

.intelligence-band,
.pipeline {
  margin-top: 1rem;
  padding: clamp(1rem, 3vw, 2rem);
}

.intelligence-band > div:first-child,
.pipeline-copy {
  max-width: 34rem;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  flex: 1;
}

.source-list article,
.pipeline-steps div {
  padding: 1rem;
  border: 1px solid rgba(143, 160, 184, 0.2);
  background: rgba(255, 255, 255, 0.04);
}

.source-list span,
.pipeline-steps span {
  color: var(--pink);
  font-weight: 900;
}

.source-list h3 {
  margin: 0.55rem 0 0.35rem;
}

.source-list p,
.pipeline-copy p {
  color: var(--muted);
}

.pipeline-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(7.5rem, 1fr));
  gap: 0.5rem;
}

.pipeline-steps div {
  display: grid;
  gap: 0.5rem;
}

.pipeline-steps strong {
  font-size: 0.9rem;
}

@media (max-width: 1050px) {
  .app-shell,
  .intelligence-band,
  .pipeline {
    grid-template-columns: 1fr;
    display: grid;
  }

  .listing-grid,
  .source-list {
    grid-template-columns: 1fr 1fr;
  }

  .pipeline-steps {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar nav {
    justify-content: space-between;
  }

  .stage-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .listing-grid,
  .source-list,
  .pipeline-steps,
  .source-meter {
    grid-template-columns: 1fr;
  }

  .rail-header h1 {
    font-size: 3rem;
  }
}
