:root {
  --bg: #010805;
  --green: #00ff6a;
  --green-dim: #00b347;
  --green-soft: rgba(0, 255, 106, 0.25);
  --amber: #ffb000;
  --red: #ff3b3b;
  --cyan: #5cffd7;
  --text: #9affb8;
  --text-dim: #3d7a55;
  --font: "IBM Plex Mono", "Share Tech Mono", ui-monospace, monospace;
  --display: "Share Tech Mono", "IBM Plex Mono", monospace;
}

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

html,
body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background:
    radial-gradient(ellipse 70% 55% at 50% 40%, #032014 0%, transparent 60%),
    radial-gradient(ellipse at center, #02150c 0%, var(--bg) 75%);
}

#globe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  touch-action: none;
  cursor: grab;
  filter: saturate(0.75) hue-rotate(70deg) brightness(0.95) contrast(1.15);
}

#globe.is-dragging {
  cursor: grabbing;
}

.scanlines,
.crt {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 3;
}

.scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px,
    rgba(0, 0, 0, 0.18) 4px
  );
  mix-blend-mode: multiply;
  opacity: 0.55;
  animation: flicker 6s infinite;
}

.crt {
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.65) 100%);
  box-shadow: inset 0 0 80px rgba(0, 255, 106, 0.08);
  transition: box-shadow 0.4s ease, filter 0.4s ease;
}

.crt.is-success {
  box-shadow:
    inset 0 0 100px rgba(0, 255, 106, 0.22),
    inset 0 0 40px rgba(0, 255, 106, 0.12);
  animation: crt-surge 0.85s ease-out;
}

.crt.is-fail {
  box-shadow:
    inset 0 0 100px rgba(255, 59, 59, 0.28),
    inset 0 0 40px rgba(255, 59, 59, 0.15);
  animation: crt-surge-fail 0.85s ease-out;
}

.hud-top {
  position: absolute;
  top: max(0.7rem, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  text-align: center;
  pointer-events: none;
  width: min(92vw, 40rem);
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
}

.hud-top__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.55rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.tag {
  border: 1px solid var(--green-soft);
  padding: 0.15rem 0.45rem;
  color: var(--green);
  text-shadow: 0 0 8px var(--green-soft);
}

.tag--dim {
  color: var(--text-dim);
  border-color: rgba(61, 122, 85, 0.45);
}

.brand {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.8rem, 6vw, 3.2rem);
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: var(--green);
  text-shadow:
    0 0 12px rgba(0, 255, 106, 0.55),
    0 0 32px rgba(0, 255, 106, 0.25);
  line-height: 1;
}

.brand span {
  animation: cursor-blink 1.05s steps(1) infinite;
}

.brand-sub {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.hud-side {
  position: absolute;
  top: 22%;
  left: clamp(0.6rem, 2vw, 1.4rem);
  z-index: 4;
  width: min(28vw, 14rem);
  max-height: 42vh;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.65;
  mask-image: linear-gradient(to bottom, transparent, #000 10%, #000 82%, transparent);
}

.packets {
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: var(--cyan);
  margin-bottom: 0.45rem;
  text-shadow: 0 0 8px rgba(92, 255, 215, 0.35);
}

.hud-side pre {
  font-size: 0.58rem;
  line-height: 1.45;
  color: var(--green-dim);
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal {
  position: absolute;
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: min(94vw, 38rem);
  padding: 0.75rem 0.85rem 0.85rem;
  border: 1px solid var(--green-soft);
  background: linear-gradient(180deg, rgba(0, 20, 10, 0.82), rgba(0, 8, 4, 0.92));
  box-shadow:
    0 0 0 1px rgba(0, 255, 106, 0.05),
    0 0 28px rgba(0, 255, 106, 0.08),
    inset 0 0 24px rgba(0, 255, 106, 0.04);
  pointer-events: none;
}

.terminal__bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.55rem;
  border-bottom: 1px solid rgba(0, 255, 106, 0.12);
  padding-bottom: 0.35rem;
}

.terminal__blink {
  color: var(--green);
  animation: cursor-blink 1.05s steps(1) infinite;
}

.terminal__line {
  font-family: var(--display);
  font-size: clamp(0.95rem, 2.8vw, 1.15rem);
  letter-spacing: 0.04em;
  color: var(--green);
  text-shadow: 0 0 10px rgba(0, 255, 106, 0.35);
  min-height: 1.4em;
}

.terminal__line.is-searching {
  animation: text-glitch 2.2s ease-in-out infinite;
}

.terminal__line.is-success {
  color: var(--green);
  text-shadow: 0 0 14px rgba(0, 255, 106, 0.65);
}

.terminal__line.is-fail {
  color: var(--red);
  text-shadow: 0 0 12px rgba(255, 59, 59, 0.45);
}

.terminal__meta {
  margin-top: 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--amber);
  min-height: 1.1em;
  opacity: 0;
  transition: opacity 0.45s ease;
  text-shadow: 0 0 8px rgba(255, 176, 0, 0.25);
  white-space: pre-line;
  line-height: 1.45;
}

.terminal__meta.is-visible {
  opacity: 1;
}

@keyframes cursor-blink {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes text-glitch {
  0%, 100% { opacity: 0.55; }
  40% { opacity: 1; }
  42% { transform: translate(1px, 0); }
  44% { transform: translate(-1px, 0); }
  46% { transform: none; }
}

@keyframes flicker {
  0%, 100% { opacity: 0.55; }
  92% { opacity: 0.55; }
  93% { opacity: 0.35; }
  94% { opacity: 0.6; }
}

@keyframes crt-surge {
  0% { filter: brightness(1.8) contrast(1.3); }
  100% { filter: none; }
}

@keyframes crt-surge-fail {
  0% { filter: brightness(1.5) sepia(0.4) hue-rotate(-20deg); }
  100% { filter: none; }
}

@media (max-width: 820px) {
  .hud-side { display: none; }

  .brand {
    font-size: clamp(1.35rem, 7vw, 2rem);
    letter-spacing: 0.16em;
    text-indent: 0.16em;
  }

  .brand-sub {
    display: none;
  }

  .hud-top__row {
    font-size: 0.58rem;
    margin-bottom: 0.35rem;
  }

  .tag {
    padding: 0.1rem 0.35rem;
  }

  .terminal {
    width: calc(100% - 1.2rem);
    max-width: none;
    padding: 0.65rem 0.7rem 0.75rem;
  }

  .terminal__line {
    font-size: 0.92rem;
  }

  .terminal__meta {
    font-size: 0.62rem;
    max-height: 4.2em;
    overflow: hidden;
  }

  .scanlines {
    opacity: 0.28;
    animation: none;
  }

  #globe {
    filter: saturate(0.8) hue-rotate(70deg) brightness(0.95) contrast(1.08);
  }
}

html.is-mobile .crt.is-success,
html.is-mobile .crt.is-fail {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .scanlines,
  .brand span,
  .terminal__blink,
  .terminal__line.is-searching,
  .crt.is-success,
  .crt.is-fail {
    animation: none;
  }
}
