/* Satellite tracking screen — xscript.net */

:root {
  --bg: #0a0e13;
  --panel: #0f151c;
  --panel-head: #141d26;
  --line: #1f2b37;
  --line-bright: #334556;
  --text: #e6eef4;
  --muted: #8197a8;
  --dim: #4e6273;
  --accent: #35d0ff;
  --accent-bg: rgba(53, 208, 255, 0.12);
  --amber: #ffb020;
  --red: #ff3b30;
  --red-bg: rgba(255, 59, 48, 0.16);
  --font-data: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-label: 'Barlow Condensed', 'Arial Narrow', var(--font-data);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--bg); }

body {
  font-family: var(--font-data);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
}

button, select { font-family: inherit; }
[hidden] { display: none !important; }

/* ---------- App shell ---------- */
.console {
  height: 100vh;
  min-height: 660px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;          /* the shared video overlay covers this */
}
.console:fullscreen { height: 100vh; width: 100vw; min-height: 0; }
.console:-webkit-full-screen { height: 100vh; width: 100vw; min-height: 0; }

/* ---------- Header ---------- */
.sh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px;
  background: var(--panel-head);
  border-bottom: 2px solid var(--accent);
  flex: 0 0 auto;
}
.sh-left, .sh-right { display: flex; align-items: center; gap: 12px; flex: 1 1 0; min-width: 0; }
.sh-right { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.sh-logo {
  width: 30px; height: 30px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 0.9rem;
  border-radius: 50%;
}
.sh-name { display: flex; flex-direction: column; line-height: 1.05; }
.sh-title { font-family: var(--font-label); font-weight: 700; font-size: 1.45rem; letter-spacing: 0.2em; color: var(--text); }
.sh-sub { font-family: var(--font-label); font-size: 0.72rem; letter-spacing: 0.24em; color: var(--muted); white-space: nowrap; }

.sh-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-label);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--bg);
  background: var(--accent);
  padding: 3px 10px;
  white-space: nowrap;
}
.sh-status .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 2s ease-in-out infinite; }
.sh-status.is-alert { background: var(--red); color: #fff; }
.sh-status.is-paused { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--muted); }
.sh-status.is-paused .dot { animation: none; }

.sh-sim {
  font-family: var(--font-label);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--amber);
  border: 1px dashed rgba(255, 176, 32, 0.6);
  padding: 3px 7px;
  white-space: nowrap;
}

.sh-center { display: flex; flex-direction: column; align-items: center; line-height: 1; flex: 0 0 auto; }
.sh-clock { font-size: 1.8rem; font-weight: 700; letter-spacing: 0.04em; color: var(--text); white-space: nowrap; }
.sh-clock small { font-size: 0.55em; color: var(--muted); margin-left: 6px; letter-spacing: 0.1em; }
.sh-clock-sub { margin-top: 4px; font-family: var(--font-label); font-size: 0.76rem; letter-spacing: 0.18em; color: var(--muted); white-space: nowrap; }

.sbtn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-bright);
  padding: 6px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.sbtn:hover, .sbtn:focus-visible { background: rgba(255, 255, 255, 0.08); border-color: var(--text); }
.sbtn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.sbtn.is-red { border-color: var(--red); color: var(--red); }
.sbtn.is-red:hover, .sbtn.is-red:focus-visible { background: var(--red-bg); border-color: var(--red); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Main grid ---------- */
.sgrid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 350px);
  gap: 8px;
  padding: 8px 10px;
}
.col { display: flex; flex-direction: column; gap: 8px; min-height: 0; min-width: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.ph {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 10px 4px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-head);
  flex: 0 0 auto;
  white-space: nowrap;
  overflow: hidden;
}
.ph-title { font-family: var(--font-label); font-size: 0.92rem; font-weight: 700; letter-spacing: 0.18em; color: var(--text); }
.ph-note { margin-left: auto; font-family: var(--font-label); font-size: 0.74rem; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; }
.ph-tools { display: flex; gap: 4px; margin-left: 8px; }
.ph-tools .sbtn { padding: 1px 7px; font-size: 0.66rem; }
.pb { flex: 1 1 auto; min-height: 0; overflow: hidden; position: relative; }

.p-map { flex: 1 1 auto; }
.p-tlm { flex: 0 0 auto; }
.p-pass { flex: 0 0 auto; }
.p-log { flex: 1 1 auto; min-height: 110px; }

/* ---------- Map ---------- */
.map canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }

.alert-banner {
  position: absolute;
  left: 0; right: 0; top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  background: var(--red);
  color: #fff;
}
.alert-word {
  font-family: var(--font-label);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1;
  white-space: nowrap;
  animation: slowBlink 2s ease-in-out infinite;
}
.alert-reason { flex: 1 1 auto; min-width: 0; font-size: 0.74rem; font-weight: 600; line-height: 1.35; letter-spacing: 0.02em; }
.alert-time { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; white-space: nowrap; }

/* Satellite selector strip */
.sats {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border-top: 1px solid var(--line);
  background: #0c1218;
}
.sat-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 7px;
  row-gap: 1px;
  align-items: center;
  text-align: left;
  padding: 5px 8px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  cursor: pointer;
  min-width: 0;
}
.sat-card:hover, .sat-card:focus-visible { border-color: var(--line-bright); background: rgba(255, 255, 255, 0.04); }
.sat-card.is-sel { border-color: var(--text); background: rgba(255, 255, 255, 0.06); }
.sc-chip { grid-row: 1; width: 8px; height: 8px; border-radius: 1px; }
.sc-name { grid-row: 1; font-family: var(--font-label); font-size: 0.95rem; font-weight: 700; letter-spacing: 0.1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-sub, .sc-st { grid-column: 1 / -1; font-size: 0.6rem; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-sub { color: var(--muted); }
.sc-st { color: var(--dim); font-weight: 700; }
.sat-card.is-live .sc-st { color: var(--accent); }
.sat-card.is-alert .sc-st { color: var(--red); }
.sat-card.is-alert { border-color: var(--red); }

/* ---------- Telemetry ---------- */
.tlm { padding: 8px 10px 9px; display: flex; flex-direction: column; gap: 8px; overflow: visible; }
.sel-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sel-chip { width: 10px; height: 10px; border-radius: 1px; flex: 0 0 auto; }
.sel-name { font-family: var(--font-label); font-size: 1.45rem; font-weight: 700; letter-spacing: 0.12em; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-cls { margin-left: auto; font-family: var(--font-label); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; border: 1px solid var(--line-bright); padding: 1px 6px; color: var(--muted); }
.sel-role { font-size: 0.64rem; color: var(--muted); letter-spacing: 0.03em; margin-top: -4px; }

.big3 { display: grid; grid-template-columns: 1.1fr 1.1fr 0.9fr; gap: 6px; }
.rd { display: flex; flex-direction: column; min-width: 0; }
.rd-l { font-family: var(--font-label); font-size: 0.76rem; letter-spacing: 0.14em; color: var(--muted); white-space: nowrap; }
.rd-v { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.rd-v b { font-size: 0.92rem; font-weight: 700; color: var(--text); }
.rd-v i { font-style: normal; font-family: var(--font-label); font-size: 0.7rem; letter-spacing: 0.1em; color: var(--dim); }
.big3 .rd { border-left: 2px solid var(--accent); padding-left: 7px; }
.big3 .rd-v b { font-size: 1.02rem; }
.rd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.rd-grid .rd { padding-left: 9px; }
.p-tlm.is-lost .big3 .rd-v b { color: var(--red); }
.p-tlm.is-lost .big3 .rd { border-left-color: var(--red); }
.p-tlm.is-lost .ph-note { color: var(--red); font-weight: 700; }

.kv { display: flex; flex-direction: column; gap: 3px; padding-top: 8px; border-top: 1px solid var(--line); }
.kv-row { display: grid; grid-template-columns: 82px 1fr; gap: 8px; align-items: baseline; font-size: 0.66rem; }
.kv-row span { font-family: var(--font-label); font-size: 0.8rem; letter-spacing: 0.14em; color: var(--muted); white-space: nowrap; }
.kv-row b { font-weight: 700; color: var(--text); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv-row.is-good b { color: var(--accent); }
.kv-row.is-bad b { color: var(--red); }

.next { display: flex; flex-direction: column; gap: 2px; padding: 7px 9px; background: #0b1117; border: 1px solid var(--line); }
.next-l { font-family: var(--font-label); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.14em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-v { font-size: 1.3rem; font-weight: 700; color: var(--text); letter-spacing: 0.03em; white-space: nowrap; }
.next-s { font-size: 0.62rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Pass schedule ---------- */
.pass { padding: 2px 0 4px; }
.pass-t { width: 100%; border-collapse: collapse; font-size: 0.64rem; }
.pass-t th { font-family: var(--font-label); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.12em; color: var(--dim); text-align: left; padding: 3px 10px 2px; white-space: nowrap; }
.pass-t td { padding: 2px 10px; color: #c2ccd4; white-space: nowrap; border-top: 1px solid rgba(255, 255, 255, 0.035); }
.pass-t th:last-child, .pass-t td:last-child { text-align: right; }
.pass-t tr.is-live td { color: var(--accent); font-weight: 700; }

/* ---------- Event log ---------- */
.loop { overflow: hidden; padding: 2px 0; }
.lg-row {
  display: grid;
  grid-template-columns: 56px 38px 1fr;
  gap: 7px;
  align-items: baseline;
  padding: 3px 10px;
  font-size: 0.64rem;
  line-height: 1.35;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}
.lg-t { color: var(--dim); font-size: 0.6rem; white-space: nowrap; }
.lg-s { font-family: var(--font-label); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); white-space: nowrap; }
.lg-x { color: #c2ccd4; min-width: 0; }
.lg-row.is-aos .lg-s { color: var(--accent); }
.lg-row.is-alert .lg-s, .lg-row.is-alert .lg-x { color: var(--red); }
.lg-row:first-child { animation: rowIn 0.4s ease-out; }
@keyframes rowIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

/* ---------- Bottom bar ---------- */
.sb {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 14px;
  border-top: 1px solid var(--line-bright);
  background: var(--panel-head);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
}
.sb-data { display: flex; align-items: center; gap: 18px; min-width: 0; overflow: hidden; }
.sb-item b { color: var(--text); font-weight: 600; }
.sb-dir { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.sb-dir .sbtn { padding: 4px 8px; font-size: 0.62rem; }
.sb-dir-l { font-family: var(--font-label); font-size: 0.76rem; letter-spacing: 0.16em; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes slowBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ---------- Reference content ---------- */
.tool-info {
  max-width: 900px;
  margin: 44px auto 40px;
  padding: 0 24px;
  color: #a3aeb8;
  line-height: 1.7;
  font-size: 0.92rem;
}
.tool-info h1 { color: var(--text); font-size: 1.3rem; letter-spacing: 0.03em; margin-bottom: 14px; line-height: 1.35; }
.tool-info h2 {
  color: var(--text);
  font-size: 1.02rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 32px 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}
.tool-info h3 { color: var(--text); font-size: 0.94rem; margin: 22px 0 6px; }
.tool-info p { margin-bottom: 12px; }
.tool-info ul { margin: 0 0 12px 22px; }
.tool-info li { margin-bottom: 6px; }
.tool-info a { color: #6fdcff; }
.tool-info strong { color: var(--text); }
.tool-info kbd {
  font-family: var(--font-data);
  font-size: 0.8em;
  border: 1px solid var(--line-bright);
  border-bottom-width: 2px;
  padding: 0 5px;
  border-radius: 3px;
  color: var(--text);
}
.glossary { margin: 0 0 12px; }
.glossary dt { color: var(--text); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.84rem; margin-top: 16px; }
.glossary dd { margin: 4px 0 0; }

.table-wrap { overflow-x: auto; margin: 0 0 14px; }
.orbit-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; min-width: 620px; }
.orbit-table th, .orbit-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.orbit-table th { color: var(--text); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; border-bottom-color: var(--line-bright); }
.orbit-table td:first-child { color: var(--text); font-weight: 600; white-space: nowrap; }

.site-foot {
  border-top: 1px solid var(--line-bright);
  background: var(--panel-head);
  padding: 15px;
  text-align: center;
  font-size: 0.8rem;
}
.site-foot-links { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.site-foot-links a { color: var(--text); text-decoration: none; }
.site-foot-links a:hover { text-decoration: underline; }
.site-foot-note { color: var(--muted); font-size: 0.72rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1500px) {
  .sh-sub { display: none; }
  .sats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1280px) {
  .sh-sim { display: none; }
  .sh-clock { font-size: 1.55rem; }
  .sh .sbtn { padding: 6px 7px; letter-spacing: 0.06em; }
  .sh-right { gap: 6px; }
  .sb-item.opt { display: none; }
}

@media (max-width: 1100px) {
  .console { height: auto; min-height: 0; }
  .sh { flex-wrap: wrap; }
  .sh-left, .sh-right { flex: 1 1 auto; }
  .sh-center { order: -1; width: 100%; }
  .sh-sim { display: inline-block; }
  .sgrid { grid-template-columns: 1fr 1fr; }
  .col-map { grid-column: 1 / -1; }
  .col-right { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .map { flex: 0 0 auto; aspect-ratio: 2 / 1.08; }
  .p-log { grid-column: 1 / -1; flex: 0 0 auto; height: 260px; }
  .sb { flex-wrap: wrap; white-space: normal; justify-content: center; }
  .sb-data { flex-wrap: wrap; justify-content: center; gap: 6px 16px; }
  .sb-dir { flex: 1 1 100%; flex-wrap: wrap; justify-content: center; }
  .alert-word { font-size: 1.3rem; }
}

@media (max-width: 680px) {
  .sgrid { padding: 6px; gap: 6px; }
  .col-right { grid-template-columns: 1fr; }
  .sats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map { aspect-ratio: 2 / 1.2; }
  .sh-right { justify-content: center; }
  .sh-left { justify-content: center; flex-wrap: wrap; }
  .sh-clock { font-size: 1.4rem; }
  .alert-banner { flex-wrap: wrap; gap: 4px 12px; padding: 6px 10px; }
  .alert-reason { flex-basis: 100%; order: 3; }
}

@media (prefers-reduced-motion: reduce) {
  .sh-status .dot, .alert-word, .lg-row:first-child { animation: none; }
  .sbtn { transition: none; }
}
