:root {
  color-scheme: dark;
  --green: #62f58a;
  --green-dim: #1c6b38;
  --amber: #ffb000;
  --bg: #000;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--green);
  font-family: "Share Tech Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  overflow: hidden;
}
button, input { font-family: inherit; }
img { -webkit-user-drag: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.noscript {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  padding: 12px 14px;
  background: #03150b;
  color: #c8ffd4;
  border: 1px solid #1c6b38;
}

.app {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.05fr) minmax(0, 0.72fr);
  grid-template-rows: minmax(0, 1.18fr) minmax(0, 0.82fr);
  gap: 6px;
  padding: 6px;
  background: #000;
  user-select: none;
}

.panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: #000;
  border: 1px solid #163322;
}
.term-panel { grid-column: 1; grid-row: 1 / span 2; border-color: #1d4d2e; }
.term-catch {
  position: absolute;
  z-index: 5;
  top: 30px;
  right: 0;
  bottom: 0;
  left: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  user-select: text;
  -webkit-user-select: text;
}
.term-catch:focus { outline: none; }
.term-catch.idle { pointer-events: none; }
.sat-panel { grid-column: 2 / span 2; grid-row: 1; border-color: #1a3d66; }
.world-panel { grid-column: 2; grid-row: 2; border-color: #145c32; }
.log-panel { grid-column: 3; grid-row: 2; border-color: #145c32; }

.panel header, .panel footer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 10px;
  letter-spacing: 0.12em;
  font-size: 13px;
  text-transform: uppercase;
  background: #04140b;
  color: #8dffb0;
  border-bottom: 1px solid #143222;
}
.panel footer {
  border-bottom: 0;
  border-top: 1px solid #143222;
  color: #3dcc6a;
  letter-spacing: 0.02em;
  font-size: 10px;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
}
.sat-panel header {
  background: #06101c;
  color: #b7dcff;
  border-bottom-color: #16385c;
}
.world-panel header { background: #04140c; }
.spacer { flex: 1; }
.dim, .slash { color: #6ea0c8; }
.sat-panel .slash.hot, #sat-phase.hot { color: #ffcc66; }

.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3dff7a;
  box-shadow: 0 0 8px #3dff7a;
  animation: blink 1.7s steps(1) infinite;
}
.led.rec {
  background: #ff3b3b;
  box-shadow: 0 0 8px #ff3b3b;
}
@keyframes blink { 50% { opacity: 0.35; } }

.term-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
  background:
    radial-gradient(ellipse at top, #04160c 0%, #010704 72%);
}
.term-scroll::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.16) 0 1px,
    transparent 1px 3px
  );
}
.term-pre {
  margin: 0;
  padding: 10px 12px 28px;
  font-size: 14px;
  line-height: 1.42;
  color: #62f58a;
  text-shadow: 0 0 6px rgba(40, 255, 110, 0.35);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
}
.vim {
  position: absolute;
  top: 30px;
  right: 0;
  bottom: 30px;
  left: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  background: #010804;
  font-size: 14px;
  line-height: 1.35;
}
.vim-body { flex: 1; overflow: auto; padding: 6px 0 10px; }
.vim-row { display: grid; grid-template-columns: 42px minmax(0, 1fr); min-height: 1.35em; }
.vim-gutter { color: #3d7a52; text-align: right; padding-right: 10px; }
.vim-code { color: #d7ffe6; white-space: pre; }
.tok-key { color: #8ecbff; }
.tok-str { color: #ffd27a; }
.tok-cmt { color: #6d907c; }
.tok-num { color: #ff9b78; }
.vim-cursor { background: #d8ffe4; color: #04140a; }
.vim-status {
  flex: none;
  display: flex;
  justify-content: space-between;
  background: #146b3a;
  color: #f3fff6;
  padding: 2px 8px;
}
.vim-cmd { flex: none; min-height: 1.4em; padding: 2px 8px; color: #e7ffe8; }

.cursor {
  color: #8dffb0;
  text-shadow: 0 0 8px #8dffb0;
  animation: caret 1.05s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.file-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #010905;
}
.file-path {
  flex: none;
  padding: 7px 10px;
  color: #ffcc66;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #1a3324;
}
.file-head, .file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px 132px 64px;
  gap: 8px;
  padding: 3px 10px;
}
.file-head {
  flex: none;
  color: #6ea87a;
  border-bottom: 1px solid #163222;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.file-list { flex: 1; overflow: auto; padding: 4px 0 10px; }
.file-row { cursor: pointer; color: #b6ff9a; font-size: 14px; }
.file-row.dir .fname { color: #9fd4ff; }
.file-row:hover, .file-row.sel { background: rgba(80, 255, 140, 0.12); }
.file-row span:not(.fname) { color: #6f8f76; }

.copy-modal {
  position: absolute;
  top: 30px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  z-index: 6;
}
.copy-card {
  width: min(480px, calc(100% - 28px));
  background: #07140c;
  border: 1px solid #3dff7a;
  box-shadow: 0 0 24px rgba(0, 255, 90, 0.22);
  padding: 14px 14px 12px;
}
.copy-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: #d8ffe4;
}
.copy-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  margin: 4px 0;
  font-size: 13px;
}
.copy-row span { color: #6f8f76; }
.copy-row b { font-weight: 400; color: #e7ffe8; overflow-wrap: anywhere; }
.bar-track {
  margin-top: 12px;
  height: 16px;
  background: #021208;
  border: 1px solid #1f8f3a;
}
.bar-fill {
  height: 100%;
  width: 0%;
  background: repeating-linear-gradient(90deg, #14ff5a 0 10px, #0cba3e 10px 12px);
  box-shadow: 0 0 10px rgba(20, 255, 90, 0.65);
}
.copy-status {
  margin-top: 8px;
  letter-spacing: 0.12em;
  color: #d8ffe4;
}
.copy-rate { min-height: 1.2em; color: #8dffb0; font-size: 13px; }
.copy-actions { display: flex; gap: 10px; margin-top: 12px; }
.btn {
  background: #031a0c;
  color: #c8ffd4;
  border: 1px solid #3dff7a;
  letter-spacing: 0.14em;
  padding: 7px 16px;
  cursor: pointer;
}
.btn:hover { background: #0c3a1c; color: #fff; }
.btn:focus { outline: none; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.ghost { border-color: #3d6b4c; color: #9cbaa4; }
.btn.armed {
  background: #145c2e;
  color: #fff;
  box-shadow: 0 0 0 2px #eafff0;
}
.btn.ghost.armed { border-color: #eafff0; color: #fff; }

.sat-view {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #071018;
}
.sat-grade {
  position: absolute;
  inset: 0;
  overflow: hidden;
  filter: grayscale(0.28) sepia(0.42) hue-rotate(188deg) saturate(2.8) brightness(0.8) contrast(1.18);
  background: #071018;
}
.sat-fit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 960px;
  height: 540px;
  transform: translate(-50%, -50%);
  transform-origin: center center;
}
.sat-scaler {
  position: absolute;
  inset: 0;
  z-index: 1;
  transform-origin: center center;
  will-change: transform;
}
.sat-frame {
  position: absolute;
  left: -112px;
  top: -112px;
  width: 1184px;
  height: 764px;
  max-width: none;
}
.sat-pixel {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.sat-wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(10, 50, 150, 0.22);
  mix-blend-mode: multiply;
}
.sat-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 8, 24, 0.55) 100%);
}
.sat-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  letter-spacing: 0.18em;
  color: #d5ecff;
  text-shadow: 0 0 8px #000;
  pointer-events: none;
}
.reticle {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(255, 160, 0, 0.9));
}
.reticle.flashing:not(.on) { opacity: 0.08; }
.reticle .c {
  position: absolute;
  width: 28%;
  height: 28%;
  min-width: 8px;
  min-height: 8px;
  max-width: 22px;
  max-height: 22px;
  border: 2px solid #ffb000;
}
.reticle.lock .c { border-width: 3px; border-color: #ff9d1c; }
.reticle.lock.pop { animation: lock-in 0.4s ease; }
@keyframes lock-in {
  0% { opacity: 0; transform: scale(1.35); }
  100% { opacity: 1; transform: none; }
}
.c.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.c.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.c.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.c.br { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.reticle-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  white-space: nowrap;
  color: #ffc14a;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-shadow: 0 0 4px #000, 0 1px 2px #000, 0 0 4px #000;
}
.meta-card {
  position: absolute;
  z-index: 5;
  width: 286px;
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  background: rgba(6, 16, 28, 0.9);
  border: 1px solid rgba(170, 210, 235, 0.65);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  color: #d7ecff;
  pointer-events: none;
}
.meta-card.show {
  visibility: visible;
  opacity: 1;
  transform: none;
}
.meta-title {
  display: flex;
  justify-content: space-between;
  padding: 5px 8px;
  background: linear-gradient(#1d4466, #12283c);
  color: #e7f4ff;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.meta-win { opacity: 0.7; }
.meta-body { padding: 6px 10px 8px; }
.meta-kicker {
  color: #8fd8ff;
  letter-spacing: 0.16em;
  margin-bottom: 6px;
}
.meta-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 6px;
  margin: 1px 0;
  font-size: 12px;
  line-height: 1.25;
}
.meta-row span { color: #8eabc0; }
.meta-row b { font-weight: 400; color: #f2f8ff; overflow-wrap: anywhere; }
.meta-row b.coord { color: #9be0ff; letter-spacing: 0.02em; }
.sat-hud {
  position: absolute;
  left: 8px;
  bottom: 20px;
  z-index: 4;
  white-space: pre-line;
  color: #d7ecff;
  font-size: 12px;
  line-height: 1.35;
  text-shadow: 0 1px 2px #000, 0 0 4px #000;
  pointer-events: none;
}
.sat-attr {
  position: absolute;
  left: 8px;
  bottom: 5px;
  z-index: 4;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: rgba(190, 220, 255, 0.6);
  pointer-events: none;
}

.globe-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.globe {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  border: 1px solid #d6f1ff;
  background: radial-gradient(circle at 32% 32%, #9fd8ff 0%, #1a6eaa 26%, #0a3a66 64%, #041525 100%);
  box-shadow: inset -6px -1px 8px rgba(0, 0, 0, 0.55), 0 0 8px rgba(120, 190, 255, 0.7);
}
.globe i {
  position: absolute;
  inset: -45% -40%;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 4px,
    rgba(230, 248, 255, 0.95) 4px 5.2px,
    transparent 5.2px 10px
  );
  animation: globe-spin 1.8s linear infinite;
}
.globe::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(#d7f2ff, #d7f2ff) center 30% / 100% 1px no-repeat,
    linear-gradient(#f4fbff, #f4fbff) center 50% / 100% 1px no-repeat,
    linear-gradient(#d7f2ff, #d7f2ff) center 70% / 100% 1px no-repeat;
}
@keyframes globe-spin {
  from { transform: translateX(0); }
  to { transform: translateX(-20px); }
}

.picker {
  position: absolute;
  top: 36px;
  right: 8px;
  width: 300px;
  max-height: calc(100% - 48px);
  overflow: auto;
  z-index: 20;
  background: rgba(4, 12, 22, 0.96);
  border: 1px solid #3a6e99;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
}
.picker h3 {
  margin: 0;
  padding: 8px 10px 3px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: #7eb0d4;
}
.picker button {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 8px;
  background: transparent;
  color: #d5ecff;
  border: 0;
  padding: 6px 10px;
  font-size: 13px;
  letter-spacing: 0.03em;
  cursor: pointer;
  text-align: left;
}
.picker button .psite {
  color: #6e93ae;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-align: right;
}
.picker button:hover, .picker button.active { background: rgba(40, 100, 160, 0.4); }
.picker button.active { color: #ffcc66; }
.picker button.active .psite { color: #e7c27a; }

.world-body { flex: 1; min-height: 0; position: relative; background: #02110a; }
.world-body canvas { width: 100%; height: 100%; display: block; }

.log-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 6px 8px 8px;
  background: #000;
  color: #2dff62;
  font-size: 12px;
  line-height: 1.38;
  text-shadow: 0 0 4px rgba(0, 255, 70, 0.25);
}

.block {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.block.deny {
  color: #ff4040;
  background:
    repeating-linear-gradient(-45deg, rgba(255, 0, 0, 0.07) 0 10px, transparent 10px 20px),
    rgba(28, 0, 0, 0.84);
}
.block.grant {
  color: #3dff78;
  background:
    repeating-linear-gradient(-45deg, rgba(0, 255, 100, 0.07) 0 10px, transparent 10px 20px),
    rgba(0, 22, 8, 0.84);
}
.block-inner {
  border: 2px solid currentColor;
  padding: 26px 42px 30px;
  text-align: center;
  min-width: min(820px, 92vw);
  box-shadow: 0 0 36px currentColor;
  background: rgba(0, 0, 0, 0.35);
}
.block-kicker { letter-spacing: 0.28em; font-size: 14px; }
.block-title {
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: min(9vw, 108px);
  letter-spacing: 0.06em;
  line-height: 0.95;
  margin: 8px 0;
  text-shadow: 0 0 24px currentColor;
  animation: glitch 0.32s steps(2, end) 1;
}
.block-sub { letter-spacing: 0.16em; font-size: 18px; }
.block-code { margin-top: 8px; letter-spacing: 0.2em; opacity: 0.85; }
.block-key { margin-top: 18px; letter-spacing: 0.28em; font-size: 16px; }
@keyframes glitch {
  0% { transform: translate(-6px, 1px); }
  40% { transform: translate(5px, -2px); }
  100% { transform: none; }
}

* { scrollbar-width: thin; scrollbar-color: #1e4d32 transparent; }

@media (max-width: 980px) {
  html, body { overflow: auto; }
  .app {
    height: auto;
    min-height: 100%;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 46vh 32vh 28vh;
  }
  .term-panel { grid-column: 1 / -1; grid-row: 1; min-height: 46vh; }
  .sat-panel { grid-column: 1 / -1; grid-row: 2; min-height: 32vh; }
  .world-panel { grid-column: 1; grid-row: 3; min-height: 28vh; }
  .log-panel { grid-column: 2; grid-row: 3; min-height: 28vh; }
}
