:root {
  --bg: #030712;
  --panel: rgba(8, 16, 34, 0.88);
  --border: rgba(0, 212, 255, 0.14);
  --text: #e8f1ff;
  --muted: #8ba3c7;
  --cyan: #00d4ff;
  --mint: #00ff9d;
  --block1: #38bdf8;
  --nextgen: #00ff9d;
  --prototype: #c084fc;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Orbitron", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --row-hover: rgba(0, 212, 255, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse 70% 40% at 20% 0%, rgba(0, 212, 255, 0.1), transparent),
    radial-gradient(ellipse 50% 30% at 100% 20%, rgba(0, 255, 157, 0.06), transparent),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
  padding-top: max(1rem, env(safe-area-inset-top));
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.crumbs a {
  color: var(--cyan);
  text-decoration: none;
}

.crumbs a:hover {
  text-decoration: underline;
}

.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.title-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.15rem, 4vw, 1.65rem);
  letter-spacing: 0.08em;
}

h1 span {
  color: var(--cyan);
}

.sub {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  max-width: 36rem;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(0, 255, 157, 0.08);
  border: 1px solid rgba(0, 255, 157, 0.35);
  font-size: 0.85rem;
}

.live-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px var(--mint);
  animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
  50% {
    opacity: 0.3;
  }
}

.mono {
  font-family: var(--mono);
}

.summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

@media (min-width: 720px) {
  .summary {
    grid-template-columns: repeat(4, 1fr);
  }
}

.sum-card {
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.sum-card .l {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.sum-card strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.1rem;
}

.sum-card strong.small {
  font-size: 0.78rem;
  font-weight: 500;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

#search {
  flex: 1 1 180px;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.5rem 0.85rem;
}

#search::placeholder {
  color: var(--muted);
}

#search:focus {
  outline: none;
  border-color: var(--cyan);
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.78rem;
  padding: 0.4rem 0.65rem;
  border-radius: 9px;
  cursor: pointer;
  min-height: 36px;
}

.seg-btn.active {
  background: rgba(0, 212, 255, 0.14);
  color: var(--cyan);
}

.btn {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(0, 212, 255, 0.3);
  background: rgba(0, 212, 255, 0.08);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--cyan);
}

/* Table */
.table-wrap {
  display: none;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 900px) {
  .table-wrap {
    display: block;
  }
  .cards {
    display: none !important;
  }
}

.tech-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.tech-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 0.75rem 0.7rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  background: #0a1428;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.tech-table td {
  padding: 0.7rem;
  border-bottom: 1px solid rgba(0, 212, 255, 0.06);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tech-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.tech-table tbody tr:hover {
  background: var(--row-hover);
}

.tech-table .name {
  font-weight: 600;
}

.tech-table .gen {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.62rem;
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  vertical-align: middle;
  font-weight: 600;
}

.tech-table .gen.nextgen {
  color: var(--nextgen);
}
.tech-table .gen.block1 {
  color: var(--block1);
}
.tech-table .gen.prototype {
  color: var(--prototype);
}

.tech-table .num {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.tech-table .more {
  color: var(--cyan);
  font-size: 0.78rem;
}

/* Mobile cards */
.cards {
  display: grid;
  gap: 0.65rem;
}

.mcard {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 0.85rem 0.95rem;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

.mcard:active {
  border-color: rgba(0, 212, 255, 0.4);
}

.mcard-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.55rem;
}

.mcard-top h2 {
  margin: 0;
  font-size: 1.05rem;
}

.mcard-top .norad {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.mgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.mgrid .c {
  padding: 0.4rem 0.5rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
}

.mgrid .c .l {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.mgrid .c .v {
  font-family: var(--mono);
  font-size: 0.82rem;
  margin-top: 0.1rem;
}

.hint {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.site-disclaimer {
  margin: 0;
  font-size: inherit;
  letter-spacing: 0.02em;
  color: var(--muted);
  opacity: 0.65;
}

.site-author {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  opacity: 0.35;
}

.site-author a {
  color: inherit;
  text-decoration: none;
}

.site-author a:hover {
  color: var(--cyan);
  text-decoration: underline;
}

.seo-about {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  max-width: 48rem;
}

.seo-about-title {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.seo-about p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Full-page detail (not a side sheet) */
.detail-page {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 70% 40% at 20% 0%, rgba(0, 212, 255, 0.1), transparent),
    radial-gradient(ellipse 50% 30% at 100% 10%, rgba(0, 255, 157, 0.06), transparent),
    var(--bg);
}

.detail-page[hidden] {
  display: none !important;
}

#view-list[hidden] {
  display: none !important;
}

.detail-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  border-bottom: 1px solid rgba(0, 212, 255, 0.12);
  background: rgba(3, 7, 18, 0.92);
  backdrop-filter: blur(14px);
}

.back-btn {
  font-size: 0.95rem;
  min-height: 44px;
  padding: 0.5rem 1rem;
}

.detail-scroll {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.15rem calc(2.5rem + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 700px) {
  .detail-scroll {
    padding: 1.35rem 1.75rem calc(3rem + env(safe-area-inset-bottom));
  }
}

/* legacy id used by JS */
#sheet-content {
  /* content lives in .detail-scroll */
}

.detail-scroll h2,
#sheet-content h2 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.55rem, 4.5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.detail-scroll .meta,
#sheet-content .meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.95rem;
  margin-bottom: 0;
}

.sheet-loading {
  padding: 3rem 0.5rem;
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 1rem;
}

/* Visual detail dashboard */
.viz-hero {
  --accent: var(--cyan);
  margin: 0 0 1.35rem;
  padding: 1.15rem 1.2rem 1.25rem;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background:
    radial-gradient(ellipse 80% 80% at 100% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent),
    rgba(0, 0, 0, 0.35);
}

.viz-hero-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1.1rem;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--mint);
  border: 1px solid rgba(0, 255, 157, 0.4);
  background: rgba(0, 255, 157, 0.08);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.live-badge i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px var(--mint);
  animation: blink 1.2s ease-in-out infinite;
}

.big-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}

@media (min-width: 520px) {
  .big-metrics {
    grid-template-columns: 1fr 1fr 1.15fr;
  }
}

.big-m {
  padding: 0.85rem 0.9rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.big-m .bl {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.big-m strong {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: clamp(1.65rem, 5vw, 2.35rem);
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  color: var(--text);
  line-height: 1.1;
}

.big-m strong.smaller {
  font-size: clamp(1.05rem, 3.2vw, 1.45rem);
}

.big-m .bu {
  margin-left: 0.25rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.gauge-row {
  display: grid;
  gap: 0.85rem;
}

.gauge-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.gauge-track {
  height: 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.gauge-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #fff);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 50%, transparent);
  transition: width 0.4s ease;
  min-width: 4px;
}

.gauge-fill.ecc {
  background: linear-gradient(90deg, #c084fc, #00d4ff);
}

.gauge-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--muted);
}

.insights {
  display: grid;
  gap: 0.65rem;
}

@media (min-width: 700px) {
  .insights {
    grid-template-columns: 1fr 1fr;
  }
}

.insight {
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(0, 212, 255, 0.12);
  background: rgba(0, 212, 255, 0.05);
}

.insight h4 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--cyan);
}

.insight p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #c5d4ea;
}

.insight.warn {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.07);
}
.insight.warn h4 {
  color: #fbbf24;
}

.insight.ok {
  border-color: rgba(0, 255, 157, 0.3);
  background: rgba(0, 255, 157, 0.06);
}
.insight.ok h4 {
  color: var(--mint);
}

.insight.muted {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(148, 163, 184, 0.06);
}
.insight.muted h4 {
  color: var(--muted);
}

.chart-note {
  margin: -0.15rem 0 0.55rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

#chart-orbit,
#chart-bstar,
#chart-mm,
#chart-ecc {
  width: 100%;
  height: 200px;
  display: block;
  border-radius: 14px;
  border: 1px solid rgba(0, 212, 255, 0.12);
}

@media (min-width: 700px) {
  #chart-orbit,
  #chart-bstar,
  #chart-mm,
  #chart-ecc {
    height: 240px;
  }
}

/* Larger section titles + data cells in detail */
.detail-scroll .sec,
#sheet-content .sec {
  margin-bottom: 1.45rem;
}

.detail-scroll .sec h3,
#sheet-content .sec h3 {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
}

.detail-scroll .kv,
#sheet-content .kv {
  gap: 0.55rem;
}

@media (min-width: 640px) {
  .detail-scroll .kv,
  #sheet-content .kv {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.detail-scroll .kv .cell,
#sheet-content .kv .cell {
  padding: 0.75rem 0.8rem;
  border-radius: 14px;
}

.detail-scroll .kv .l,
#sheet-content .kv .l {
  font-size: 0.72rem;
  letter-spacing: 0.07em;
}

.detail-scroll .kv .v,
#sheet-content .kv .v {
  margin-top: 0.2rem;
  font-size: 1.05rem;
}

.detail-scroll .kv .v.mono,
#sheet-content .kv .v.mono {
  font-size: 0.95rem;
}

.detail-scroll .tle,
#sheet-content .tle {
  font-size: 0.78rem;
  line-height: 1.55;
  padding: 0.95rem 1rem;
  border-radius: 14px;
}

.detail-scroll .links a,
#sheet-content .links a {
  min-height: 48px;
  padding: 0.55rem 0.95rem;
  font-size: 0.95rem;
  border-radius: 12px;
}

.sec {
  margin-bottom: 1.1rem;
}

.sec h3 {
  margin: 0 0 0.5rem;
  font-family: var(--display);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--cyan);
  text-transform: uppercase;
}

.kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.kv .cell {
  padding: 0.5rem 0.55rem;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(0, 212, 255, 0.08);
}

.kv .cell.full {
  grid-column: 1 / -1;
}

.kv .l {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.kv .v {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.kv .v.mono {
  font-family: var(--mono);
  font-size: 0.78rem;
}

.tle {
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  padding: 0.7rem;
  border-radius: 12px;
  background: #020617;
  border: 1px solid rgba(0, 212, 255, 0.12);
  color: #a5f3fc;
  margin: 0;
}

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

.links a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 212, 255, 0.25);
  color: var(--text);
  text-decoration: none;
  font-size: 0.8rem;
  background: rgba(0, 212, 255, 0.06);
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.8rem;
  background: rgba(3, 7, 18, 0.93);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.loader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(0, 212, 255, 0.15);
  border-top-color: var(--cyan);
  animation: spin 0.85s linear infinite;
}

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

.loader p {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}
