:root {
  color-scheme: dark;
  --bg: #000000;
  --panel: rgba(8, 10, 12, 0.72);
  --panel-solid: #07080a;
  --line: rgba(255, 255, 255, 0.1);
  --text: rgba(255, 255, 255, 0.94);
  --muted: rgba(255, 255, 255, 0.5);
  --soft: rgba(255, 255, 255, 0.74);
  --accent: #4da3ff;
  --live: #3dd68c;
  --danger: #f07178;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: Inter, system-ui, -apple-system, sans-serif;
  --touch: 36px;
  --radius: 14px;
  font-family: var(--sans);
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: -0.18px;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
html, body, #root {
  margin: 0;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
}
body {
  min-height: 100%;
  overflow: hidden;
  background: #000;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.app-shell {
  position: relative;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #000;
}

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 56px;
  padding: 0.7rem 1.05rem 0.55rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.18) 72%, transparent);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  min-width: 0;
}
.mark {
  display: inline-flex;
  color: #fff;
  line-height: 0;
}
.topbar h1 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}

.atlas-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: rgba(10, 12, 14, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0.22rem 0.9rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 500;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.on {
  color: #fff;
  background: #1c1e22;
}

.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(10, 12, 14, 0.55);
  color: #fff;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.menu-lines {
  display: grid;
  gap: 3px;
  width: 14px;
}
.menu-lines i {
  display: block;
  height: 1.4px;
  background: #fff;
  border-radius: 999px;
}

.map-stage,
.map-wrap,
.map-root {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.map-root { background: #000; }

.panel {
  position: absolute;
  z-index: 7;
  background: var(--panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  padding: 0.8rem 0.85rem 0.95rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.layer-panel {
  top: 4.6rem;
  left: 0.85rem;
  width: min(292px, calc(100vw - 1.7rem));
  max-height: calc(100dvh - 7.4rem);
  transform: translateX(-120%);
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}
.layer-panel.open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.brief-panel {
  top: 4.6rem;
  right: 0.85rem;
  width: min(320px, calc(100vw - 1.7rem));
  max-height: calc(100dvh - 7.4rem);
  transform: translateX(120%);
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}
.brief-panel.open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.panel-head h2 {
  margin: 0.12rem 0 0;
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.6rem;
  color: var(--muted);
  font-weight: 500;
}
.muted { color: var(--muted); font-size: 0.75rem; margin: 0.4rem 0 0; }
.hint { color: var(--muted); font-size: 0.7rem; margin: 0.85rem 0 0; line-height: 1.45; }

.layer-list { display: grid; gap: 0.7rem; margin: 0.85rem 0; }
.layer-group { display: grid; gap: 0.15rem; }
.layer-row, .radius-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.28rem 0.15rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  min-height: 0;
}
.layer-name { flex: 1; font-size: 0.8rem; color: var(--soft); }
.layer-row input { accent-color: #fff; width: 0.9rem; height: 0.9rem; min-height: 0; }
.layer-empty, .layer-hint {
  flex: 1 0 100%;
  color: var(--muted);
  font-size: 0.68rem;
}
.layer-row-fail .layer-name { color: var(--danger); }
.health {
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  font-weight: 500;
  padding: 0.08rem 0.32rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.health-ok { color: var(--live); border-color: rgba(61, 214, 140, 0.35); }
.health-blocked, .health-error { color: var(--danger); }
.truth {
  display: inline-block;
  margin-right: 0.4rem;
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.54rem;
  letter-spacing: 0.06em;
  font-weight: 500;
  padding: 0.06rem 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  vertical-align: 0.08em;
}
.truth-live { color: var(--live); border-color: rgba(61, 214, 140, 0.4); }
.truth-catalog { color: var(--soft); }
.truth-proxy { color: var(--muted); }
.truth-unknown { color: var(--muted); opacity: 0.8; }

.jump-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; margin-top: 0.7rem; }
.jump-row-3 { grid-template-columns: 1fr; }
.jump {
  width: 100%;
  min-height: 32px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.7rem;
}
.jump:hover { border-color: rgba(77, 163, 255, 0.45); color: #fff; }

.radius-row { flex-direction: column; align-items: stretch; gap: 0.3rem; margin-top: 0.2rem; }
.radius-row > span { color: var(--muted); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
.radius-controls { display: flex; align-items: center; gap: 0.6rem; }
.radius-controls input { width: 100%; accent-color: #fff; min-height: 18px; }
.radius-controls strong { font-family: var(--mono); font-size: 0.72rem; font-weight: 500; }

.map-jump-bar {
  position: absolute;
  left: 0.85rem;
  bottom: 2.4rem;
  z-index: 5;
  display: flex;
  gap: 0.35rem;
}
.jump-btn {
  min-height: 32px;
  padding: 0.3rem 0.78rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 10, 12, 0.62);
  color: var(--soft);
  font-size: 0.72rem;
  font-weight: 500;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.jump-btn:hover { color: #fff; border-color: rgba(77, 163, 255, 0.45); }
.jump-permian { color: var(--text); }

.maplibregl-ctrl-top-right { top: 4.35rem !important; right: 0.85rem !important; }
.maplibregl-ctrl-bottom-right { bottom: 2.15rem !important; right: 0.85rem !important; }
.maplibregl-ctrl-group {
  background: rgba(8, 10, 12, 0.62) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: none !important;
  border-radius: 999px !important;
  overflow: hidden;
  backdrop-filter: blur(14px);
}
.maplibregl-ctrl-group button {
  background: transparent !important;
  width: 32px !important;
  height: 32px !important;
  filter: invert(1);
}
.maplibregl-ctrl-scale {
  background: rgba(0, 0, 0, 0.55) !important;
  border-color: var(--line) !important;
  color: var(--muted) !important;
  font-family: var(--mono) !important;
  font-size: 0.58rem !important;
}

.brief-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.ghost {
  min-height: 28px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  font-size: 0.7rem;
}
.ghost:hover { color: #fff; border-color: rgba(255, 255, 255, 0.28); }

.loading {
  margin-top: 0.85rem;
  padding: 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
}
.skeleton-lines { display: grid; gap: 0.4rem; margin-bottom: 0.55rem; }
.skeleton-lines span {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #141414, #262626, #141414);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.skeleton-lines span:nth-child(2) { width: 72%; }
.skeleton-lines span:nth-child(3) { width: 54%; }
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.brief-body { margin-top: 0.65rem; display: grid; gap: 0.15rem; }
.brief-empty { margin-top: 0.7rem; }
.brief-row {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 0.45rem;
  padding: 0.32rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
}
.brief-row span { color: var(--muted); }
.brief-row strong {
  color: var(--text);
  font-weight: 500;
  text-align: right;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 0.7rem;
}
.section-label {
  margin-top: 0.7rem;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.unknown-list, .error-list {
  margin: 0.3rem 0 0;
  padding-left: 1rem;
  color: var(--muted);
  font-size: 0.72rem;
}
.error-list { color: var(--danger); }

.attr-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  padding: 0.45rem 0.95rem 0.5rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.88), transparent);
  color: var(--muted);
  font-size: 0.68rem;
  pointer-events: none;
}
.attr-footer a, .attr-footer .attr-brand-row { pointer-events: auto; }
.attr-brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.45rem;
}
.attr-sep { opacity: 0.4; }
.builder-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.builder-link:hover { text-decoration: underline; }
.attr-data { opacity: 0.75; }

.boot-veil {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.05rem;
  background: #000;
  pointer-events: none;
  transition: opacity 280ms ease;
}
.boot-veil.ready {
  opacity: 0;
}
.boot-mark {
  position: relative;
  width: 88px;
  height: 88px;
  color: #fff;
}
.boot-glow {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77, 163, 255, 0.32) 0%, rgba(77, 163, 255, 0.08) 42%, transparent 70%);
}
.boot-mark svg { position: relative; display: block; }
.boot-orbit {
  fill: none;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 1;
}
.boot-sat {
  fill: #fff;
  transform-origin: 44px 44px;
  animation: boot-orbit 3.6s linear infinite;
}
.boot-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: #fff;
}
@keyframes boot-orbit {
  to { transform: rotate(360deg); }
}

.layers-fab,
.sheet-backdrop,
.sheet-grab {
  display: none;
}
.sheet-close { display: inline-flex; align-items: center; }

@media (max-width: 980px) {
  .topbar {
    padding: 0.45rem 0.75rem;
    min-height: 52px;
  }
  .atlas-nav { display: none; }
  .menu-btn { display: inline-flex; }
  .topbar h1 { font-size: 0.82rem; letter-spacing: 0.1em; }

  .map-jump-bar {
    top: 3.55rem;
    left: 0.75rem;
    bottom: auto;
  }

  .sheet-backdrop {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 7;
    background: rgba(0, 0, 0, 0.4);
    border: 0;
    padding: 0;
    min-height: 0;
  }
  .sheet-backdrop.show { display: block; }

  .sheet-grab {
    display: block;
    width: 36px;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    margin: 0 auto 0.55rem;
  }

  .layer-panel,
  .brief-panel {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: min(56dvh, 520px);
    border-radius: 16px 16px 0 0;
    transform: translateY(110%);
    opacity: 1;
  }
  .layer-panel.open,
  .brief-panel.open { transform: translateY(0); }
  .brief-panel:not(.open) { display: block; pointer-events: none; }
  .brief-empty { display: none; }

  .attr-data { display: none; }
}

@media (min-width: 981px) {
  .app-shell.layers-open .map-jump-bar { left: 19.4rem; }
}
