/* HUD lendas hacker — moldura terminal + identidade PT */

.legend-hud__azulejo {
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-color: transparent;
  background-image:
    linear-gradient(45deg, rgba(26, 90, 122, 0.35) 25%, transparent 25%, transparent 75%, rgba(26, 90, 122, 0.35) 75%),
    linear-gradient(45deg, rgba(26, 90, 122, 0.35) 25%, transparent 25%, transparent 75%, rgba(26, 90, 122, 0.35) 75%),
    radial-gradient(circle at 50% 50%, rgba(42, 122, 158, 0.25) 18%, transparent 19%);
  background-size: 32px 32px, 32px 32px, 64px 64px;
  background-position: 0 0, 16px 16px, 0 0;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, #000 20%, transparent 88%);
}

.legend-hud__armilar {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(72vw, 420px);
  height: min(72vw, 420px);
  transform: translate(-50%, -50%);
  color: rgba(201, 162, 39, 0.14);
  animation: armilar-spin 90s linear infinite;
  filter: drop-shadow(0 0 28px rgba(201, 162, 39, 0.12));
}

.legend-hud__armilar svg {
  width: 100%;
  height: 100%;
}

/* —— Laterais harmoniosas —— */
.legend-hud__side-left {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(26vw, 300px);
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  mask-image: linear-gradient(90deg, #000 0%, #000 48%, transparent 100%);
}

.legend-hud__side-right {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(10vw, 118px);
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  mask-image: linear-gradient(270deg, #000 0%, #000 55%, transparent 100%);
}

.legend-hud__matrix-rain.matrix-code-bg {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

.matrix-code-bg__columns {
  position: absolute;
  left: 0.5rem;
  right: 0.25rem;
  top: 0.5rem;
  bottom: 0;
  display: flex;
  flex-direction: row;
  gap: 0.55rem;
  padding: 0 0.25rem 1rem;
  overflow: hidden;
}

.matrix-code-col-wrap {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.matrix-code-col-track {
  margin: 0;
  padding: 0;
  border: 0;
  font-family: var(--font-mono);
  font-size: clamp(0.5rem, 0.62vw, 0.6rem);
  font-weight: 500;
  line-height: 1.5;
  color: rgba(0, 255, 136, 0.24);
  white-space: pre-wrap;
  word-break: break-word;
  will-change: transform;
  animation: matrix-code-drift-down var(--code-dur, 88s) linear infinite;
  animation-delay: var(--code-delay, 0s);
}

.side-hex-wrap {
  height: 100%;
  padding: 5rem 0.35rem 2rem 0;
  overflow: hidden;
}

.side-hex-track {
  margin: 0;
  padding: 0;
  border: 0;
  font-family: var(--font-mono);
  font-size: 0.48rem;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: 0.03em;
  color: rgba(0, 229, 255, 0.26);
  text-align: right;
  white-space: pre;
  font-variant-numeric: tabular-nums;
  will-change: transform;
  animation: matrix-code-drift-down 92s linear infinite;
  animation-delay: -30s;
}

.legend-hud__escudo-3d {
  position: absolute;
  left: 0.75rem;
  top: 10vh;
  width: 140px;
  height: 140px;
  transform-style: preserve-3d;
  perspective: 720px;
  animation: escudo-float 8s ease-in-out infinite;
  filter:
    drop-shadow(0 0 20px rgba(0, 255, 136, 0.22))
    drop-shadow(0 0 32px rgba(201, 162, 39, 0.28));
  z-index: 6;
}

.legend-hud__escudo-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform: rotateY(-28deg) rotateX(12deg) translateZ(24px);
  animation: escudo-tilt 9s ease-in-out infinite alternate;
}

.legend-hud__escudo-inner .escudo-pt-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  animation: escudo-shimmer 5s ease-in-out infinite alternate;
}

.legend-hud__escudo-inner::after {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: linear-gradient(
    180deg,
    transparent 38%,
    rgba(0, 255, 136, 0.14) 50%,
    transparent 62%
  );
  animation: escudo-scan 2.8s linear infinite;
  pointer-events: none;
  mix-blend-mode: screen;
}

.legend-hud__escudo-glow {
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle, rgba(0, 255, 136, 0.35) 0%, rgba(232, 0, 42, 0.15) 45%, transparent 70%);
  animation: escudo-glow-pulse 3s ease-in-out infinite;
  z-index: -1;
}

.legend-hud__escudo-3d::before,
.legend-hud__escudo-3d::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.legend-hud__escudo-3d::before {
  width: 140%;
  height: 140%;
  border: 1px solid rgba(0, 229, 255, 0.25);
  animation: escudo-orbit-4d 6s linear infinite;
  box-shadow:
    0 0 20px rgba(0, 229, 255, 0.2),
    inset 0 0 16px rgba(0, 255, 136, 0.08);
}

.legend-hud__escudo-3d::after {
  width: 175%;
  height: 175%;
  border: 1px dashed rgba(201, 162, 39, 0.2);
  animation: escudo-orbit-4d 9s linear infinite reverse;
}

@keyframes escudo-orbit-4d {
  0% { transform: translate(-50%, -50%) rotateX(72deg) rotateY(0deg) rotateZ(0deg); }
  100% { transform: translate(-50%, -50%) rotateX(72deg) rotateY(360deg) rotateZ(180deg); }
}

.legend-hud__script-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

/* Código principal fica em .matrix-code-bg — evitar duplicar e tapar leitura */
.legend-hud__script-layer,
.legend-hud__matrix-wall--left,
.legend-hud__code-panel {
  display: none !important;
}

.legend-hud__script-layer {
  position: absolute;
  top: 0;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: pre;
  mask-image: linear-gradient(180deg, transparent 0%, #000 3%, #000 97%, transparent 100%);
}

.legend-hud__script-layer--deep {
  left: 0;
  width: min(38vw, 480px);
  font-size: 0.62rem;
  line-height: 1.32;
  color: rgba(0, 255, 136, 0.38);
  text-shadow: 0 0 14px rgba(0, 255, 136, 0.35);
  filter: blur(0.35px);
  opacity: 1;
  z-index: 1;
}

.legend-hud__script-layer--mid {
  left: 0;
  width: min(34vw, 420px);
  font-size: 0.68rem;
  line-height: 1.34;
  color: rgba(0, 255, 136, 0.62);
  text-shadow:
    0 0 16px rgba(0, 255, 136, 0.55),
    0 0 32px rgba(0, 255, 136, 0.2);
  opacity: 1;
  z-index: 2;
}

.legend-hud__script-layer--front {
  left: 0;
  width: min(30vw, 360px);
  font-size: 0.72rem;
  line-height: 1.36;
  color: rgba(0, 255, 136, 0.88);
  text-shadow:
    0 0 18px rgba(0, 255, 136, 0.75),
    0 0 36px rgba(0, 255, 136, 0.35);
  opacity: 1;
  z-index: 3;
}

.legend-hud__script-layer .script-col {
  display: inline-block;
  vertical-align: top;
  width: auto;
  min-width: 9rem;
  max-width: 14rem;
  padding-right: 0.5rem;
  animation: script-fall linear infinite;
  white-space: pre-wrap;
  word-break: break-word;
}

.legend-hud__script-layer--deep .script-col {
  animation-name: script-fall-slow;
}

@keyframes script-fall {
  0% { transform: translateY(-12%); }
  100% { transform: translateY(12%); }
}

@keyframes script-fall-slow {
  0% { transform: translateY(-6%); }
  100% { transform: translateY(6%); }
}

.legend-hud__matrix-wall {
  position: absolute;
  top: 0;
  bottom: 0;
  width: min(28vw, 320px);
  overflow: hidden;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.28;
  white-space: pre;
  opacity: 1;
  mask-image: linear-gradient(180deg, transparent 0%, #000 2%, #000 98%, transparent 100%);
  z-index: 4;
}

.legend-hud__matrix-wall--left {
  left: 0;
  color: rgba(0, 255, 136, 0.82);
  text-shadow:
    0 0 14px rgba(0, 255, 136, 0.7),
    0 0 28px rgba(0, 255, 136, 0.3);
  background: linear-gradient(90deg, rgba(0, 60, 30, 0.45) 0%, transparent 100%);
}

.legend-hud__matrix-wall--right {
  right: 0;
  width: min(10vw, 110px);
  color: rgba(0, 229, 255, 0.22);
  text-align: right;
  font-size: 0.5rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-shadow: none;
  background: none;
  opacity: 0.55;
  z-index: 3;
}

.legend-hud__matrix-wall .matrix-col {
  display: inline-block;
  vertical-align: top;
  width: auto;
  max-width: 6.5rem;
  padding-right: 0.25rem;
  animation: matrix-fall linear infinite;
}

.legend-hud__matrix-wall--right .matrix-col {
  max-width: 4.8rem;
  font-variant-numeric: tabular-nums;
}

@keyframes matrix-fall {
  0% { transform: translateY(-8%); }
  100% { transform: translateY(8%); }
}

.legend-hud__network-map {
  position: absolute;
  inset: 8% 10% 12%;
  width: auto;
  height: auto;
  opacity: 0.14;
  pointer-events: none;
  z-index: 0;
  filter: drop-shadow(0 0 18px rgba(0, 255, 136, 0.15));
  animation: network-drift 28s ease-in-out infinite alternate;
}

.legend-hud__network-lines {
  stroke: rgba(0, 255, 136, 0.22);
}

.legend-hud__network-nodes {
  fill: rgba(0, 255, 136, 0.55);
  animation: network-pulse 3.5s ease-in-out infinite;
}

.legend-hud__anon-emblem {
  position: absolute;
  right: 14%;
  top: 42%;
  width: min(16vw, 140px);
  height: auto;
  color: rgba(0, 255, 136, 0.12);
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
  filter: none;
  animation: anon-float 12s ease-in-out infinite;
}

.legend-hud__anon-emblem svg {
  width: 100%;
  height: auto;
}

@keyframes network-drift {
  0% { transform: scale(1) translate(0, 0); opacity: 0.28; }
  100% { transform: scale(1.04) translate(1%, -1%); opacity: 0.38; }
}

@keyframes network-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.75; }
}

@keyframes anon-float {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.45; }
  50% { transform: translateY(-8px) scale(1.03); opacity: 0.6; }
}

.legend-hud__hex--left,
.legend-hud__hex--right {
  opacity: 0.15;
}

@keyframes panel-scroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

@keyframes escudo-float {
  0%, 100% { transform: translateY(0) translateZ(0); }
  50% { transform: translateY(-8px) translateZ(12px); }
}

@keyframes escudo-tilt {
  0% { transform: rotateY(-32deg) rotateX(10deg) translateZ(24px); }
  100% { transform: rotateY(-18deg) rotateX(18deg) translateZ(36px); }
}

@keyframes escudo-glow-pulse {
  0%, 100% { opacity: 0.65; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes escudo-shimmer {
  0% { filter: brightness(1) saturate(1.08) hue-rotate(0deg); }
  100% { filter: brightness(1.14) saturate(1.2) hue-rotate(4deg); }
}

@keyframes escudo-scan {
  0% { transform: translateY(-120%); opacity: 0; }
  15% { opacity: 0.85; }
  85% { opacity: 0.85; }
  100% { transform: translateY(120%); opacity: 0; }
}

.legend-hud {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  font-family: var(--font-mono);
}

.legend-hud__crt {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 0;
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.35),
    inset 0 0 40px rgba(0, 255, 136, 0.04);
  mask-image: linear-gradient(90deg, transparent 0%, #000 18%, #000 82%, transparent 100%);
}

.legend-hud__corner {
  position: absolute;
  width: 72px;
  height: 72px;
  border: 2px solid rgba(0, 255, 136, 0.45);
  opacity: 0.7;
  animation: hud-corner-pulse 3s ease-in-out infinite;
}

.legend-hud__corner--tl {
  top: 0.65rem;
  left: 0.65rem;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -4px -4px 18px rgba(0, 255, 136, 0.15);
}

.legend-hud__corner--tr {
  top: 0.65rem;
  right: 0.65rem;
  border-left: 0;
  border-bottom: 0;
  border-color: rgba(232, 0, 42, 0.42);
  box-shadow: 4px -4px 18px rgba(232, 0, 42, 0.15);
}

.legend-hud__corner--bl {
  bottom: 0.65rem;
  left: 0.65rem;
  border-right: 0;
  border-top: 0;
  box-shadow: -4px 4px 18px rgba(0, 255, 136, 0.12);
}

.legend-hud__corner--br {
  bottom: 0.65rem;
  right: 0.65rem;
  border-left: 0;
  border-top: 0;
  box-shadow: 4px 4px 18px rgba(0, 229, 255, 0.12);
}

.legend-hud__corner::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

.legend-hud__corner--tl::after { top: -4px; left: -4px; }
.legend-hud__corner--tr::after { top: -4px; right: -4px; }
.legend-hud__corner--bl::after { bottom: -4px; left: -4px; }
.legend-hud__corner--br::after { bottom: -4px; right: -4px; }

.legend-hud__rail {
  position: absolute;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(0, 255, 136, 0.38);
  white-space: nowrap;
}

.legend-hud__rail--top {
  top: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
}

.legend-hud__rail--bottom {
  bottom: 0.75rem;
  left: 0;
  right: 0;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.legend-hud__ticker-track {
  display: inline-block;
  padding-left: 100%;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: rgba(0, 255, 136, 0.42);
  animation: hud-ticker 42s linear infinite;
}

.legend-hud__entity {
  display: none;
}

.legend-hud__entity-tag {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  color: rgba(0, 229, 255, 0.55);
  text-shadow: 0 0 20px rgba(0, 229, 255, 0.35);
  animation: hud-tag-flicker 5s steps(1) infinite;
}

.legend-hud__entity-name {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: rgba(0, 255, 136, 0.75);
  text-shadow:
    0 0 24px rgba(0, 255, 136, 0.45),
    0 0 48px rgba(0, 255, 136, 0.15);
  min-height: 1.4em;
  transition: opacity 0.35s ease;
}

.legend-hud__entity-sub {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: rgba(201, 162, 39, 0.62);
  text-shadow: 0 0 12px rgba(201, 162, 39, 0.25);
  min-height: 1em;
  transition: opacity 0.35s ease;
}

.legend-hud__entity-status {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  color: rgba(255, 176, 32, 0.55);
}

.legend-hud__hex {
  position: absolute;
  font-size: 0.52rem;
  letter-spacing: 0.1em;
  color: rgba(0, 255, 136, 0.28);
}

.legend-hud__hex--left {
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
}

.legend-hud__hex--right {
  right: 1.1rem;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
}

.legend-hud__pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(88vw, 520px);
  height: min(88vw, 520px);
  transform: translate(-50%, -50%);
  border: 1px solid rgba(0, 255, 136, 0.08);
  border-radius: 50%;
  animation: hud-ring-expand 6s ease-out infinite;
}

.legend-hud__pulse-ring:nth-child(2) { animation-delay: 2s; }
.legend-hud__pulse-ring:nth-child(3) { animation-delay: 4s; }

@keyframes armilar-spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes hud-ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

@keyframes hud-corner-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.9; }
}

@keyframes hud-tag-flicker {
  0%, 94%, 100% { opacity: 1; }
  95% { opacity: 0.4; }
  96% { opacity: 1; }
  97% { opacity: 0.6; }
}

@keyframes hud-ring-expand {
  0% {
    transform: translate(-50%, -50%) scale(0.55);
    opacity: 0.45;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 0;
  }
}

@media (max-width: 767px) {
  .legend-hud__corner {
    width: 44px;
    height: 44px;
  }

  .legend-hud__entity {
    top: 4.5rem;
  }

  .legend-hud__entity-name {
    font-size: 0.72rem;
  }

  .legend-hud__hex {
    display: none;
  }

  .legend-hud__escudo-3d {
    width: 80px;
    height: 80px;
    left: 0.25rem;
    opacity: 0.9;
  }

  .legend-hud__code-panel,
  .legend-hud__matrix-wall,
  .legend-hud__script-layer,
  .legend-hud__script-overlay,
  .legend-hud__network-map,
  .legend-hud__anon-emblem,
  .legend-hud__side-left,
  .legend-hud__side-right {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .legend-hud__ticker-track,
  .legend-hud__corner,
  .legend-hud__entity-tag,
  .legend-hud__pulse-ring,
  .legend-hud__armilar {
    animation: none !important;
  }
}
