:root {
  --bg: #05080f;
  --hud: #91f0ff;
  --hud-dim: rgba(145, 240, 255, 0.35);
  --hud-bright: #f8b66f;
  --panel-bg: rgba(8, 17, 28, 0.7);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  font-family: "Rajdhani", sans-serif;
  color: #e5fbff;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 65% 22%, rgba(255, 171, 90, 0.16), transparent 45%),
    radial-gradient(circle at 20% 75%, rgba(74, 173, 255, 0.12), transparent 55%);
}

.grid {
  position: absolute;
  inset: 0;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(107, 177, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(107, 177, 255, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 80%);
  animation: drift 20s linear infinite;
}

.scanline {
  position: absolute;
  inset: -120% 0 auto 0;
  height: 28%;
  opacity: 0.35;
  background: linear-gradient(to bottom, transparent, rgba(190, 226, 255, 0.2), transparent);
  filter: blur(8px);
  animation: scan 8s ease-in-out infinite;
}

.title-block {
  position: absolute;
  left: clamp(16px, 4vw, 48px);
  top: clamp(16px, 3vw, 40px);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 12px rgba(255, 184, 112, 0.65),
    0 0 30px rgba(255, 140, 72, 0.45),
    0 0 44px rgba(255, 122, 55, 0.22);
}

.title-block h1 {
  margin: 0.15rem 0 0;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.2rem, 2.6vw, 2.1rem);
  color: #fff6ea;
}

.eyebrow {
  margin: 0;
  color: #ffc58f;
  font-weight: 600;
  font-size: clamp(0.75rem, 1.2vw, 0.95rem);
  text-shadow:
    0 0 8px rgba(255, 182, 102, 0.9),
    0 0 20px rgba(255, 140, 64, 0.55);
}

.top-actions {
  position: absolute;
  left: clamp(16px, 4vw, 48px);
  top: clamp(88px, 12vw, 136px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  pointer-events: auto;
}

.contract-card {
  position: relative;
  width: min(470px, 92vw);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "label copy"
    "value copy";
  gap: 4px 12px;
  padding: 10px 12px;
  border: 1px solid rgba(233, 249, 255, 0.45);
  clip-path: polygon(0 0, 93% 0, 100% 35%, 100% 100%, 8% 100%, 0 58%);
  background:
    linear-gradient(135deg, rgba(7, 18, 28, 0.92), rgba(9, 22, 37, 0.74)),
    repeating-linear-gradient(90deg, rgba(161, 236, 255, 0.08) 0 1px, transparent 1px 14px);
  box-shadow:
    0 0 18px rgba(141, 226, 255, 0.16),
    inset 0 0 14px rgba(203, 247, 255, 0.08);
}

.contract-label {
  grid-area: label;
  margin: 0;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(210, 239, 255, 0.82);
}

.contract-value {
  grid-area: value;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(0.68rem, 1.45vw, 0.85rem);
  letter-spacing: 0.05em;
  color: #f4fcff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 10px rgba(188, 241, 255, 0.24);
}

.copy-contract {
  grid-area: copy;
  align-self: center;
  border: 1px solid rgba(243, 252, 255, 0.62);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: "Orbitron", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 12px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.copy-contract:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.3);
}

.copy-contract.copied {
  background: rgba(197, 245, 255, 0.28);
  box-shadow: 0 0 24px rgba(200, 245, 255, 0.38);
}

.community-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.fx-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.44);
  color: rgba(236, 252, 255, 0.95);
  text-decoration: none;
  text-transform: uppercase;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.08em;
  font-size: 0.64rem;
  padding: 8px 10px;
  clip-path: polygon(0 0, 88% 0, 100% 48%, 100% 100%, 0 100%);
  background: linear-gradient(140deg, rgba(9, 20, 33, 0.88), rgba(13, 31, 49, 0.76));
  overflow: hidden;
  transition: transform 170ms ease, border-color 180ms ease, box-shadow 190ms ease;
}

.fx-link::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-108%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
}

.fx-link:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.88);
  box-shadow:
    0 0 16px rgba(255, 255, 255, 0.3),
    inset 0 0 10px rgba(194, 245, 255, 0.15);
}

.fx-link:hover::before {
  animation: link-scan 520ms ease forwards;
}

.reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(140px, 21vw, 300px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px solid var(--hud-dim);
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 20px rgba(73, 181, 255, 0.22);
  animation: pulse 3.2s ease-in-out infinite;
}

.reticle::before,
.reticle::after {
  content: "";
  position: absolute;
  border: 1px dashed rgba(145, 240, 255, 0.3);
  border-radius: 50%;
}

.reticle::before {
  inset: 12%;
  animation: spin 16s linear infinite;
}

.reticle::after {
  inset: 26%;
  animation: spin-reverse 12s linear infinite;
}

.touch-flare {
  position: absolute;
  width: 180px;
  aspect-ratio: 1;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.25);
  border-radius: 50%;
  border: 2px solid rgba(249, 190, 122, 0.75);
  box-shadow:
    0 0 28px rgba(249, 190, 122, 0.55),
    inset 0 0 24px rgba(249, 190, 122, 0.3);
}

.touch-flare.active {
  animation: flare 900ms cubic-bezier(0.2, 0.9, 0.25, 1);
}

.poly-flash {
  position: absolute;
  width: 240px;
  height: 240px;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6);
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.55));
}

.poly-flash svg {
  width: 100%;
  height: 100%;
}

.poly-main,
.poly-accent,
.poly-scan {
  fill: none;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 1.6;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
}

.poly-accent {
  stroke: rgba(183, 237, 255, 0.95);
  stroke-width: 1.3;
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
}

.poly-scan {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 1;
  stroke-dasharray: 172;
  stroke-dashoffset: 172;
}

.poly-flash.active {
  animation: poly-pop 760ms cubic-bezier(0.2, 0.84, 0.2, 1);
}

.poly-flash.active .poly-main {
  animation: draw-main 640ms ease forwards;
}

.poly-flash.active .poly-accent {
  animation: draw-accent 560ms 120ms ease forwards;
}

.poly-flash.active .poly-scan {
  animation: draw-scan 430ms 180ms ease forwards;
}

.panel-beam {
  position: absolute;
  height: 2px;
  width: 0;
  opacity: 0;
  transform-origin: left center;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.85) 48%, rgba(193, 238, 255, 0.95)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.4) 0 10px, rgba(255, 255, 255, 0.05) 10px 18px);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.45);
}

.panel-beam.active {
  animation: beam-fire 760ms cubic-bezier(0.16, 0.8, 0.22, 1);
}

.info-panel {
  position: absolute;
  right: clamp(12px, 3vw, 34px);
  top: 50%;
  width: min(380px, 88vw);
  transform: translate(115%, -50%);
  opacity: 0;
  padding: clamp(14px, 2.2vw, 24px);
  border: 1px solid rgba(210, 241, 255, 0.6);
  clip-path: polygon(0 0, 90% 0, 100% 12%, 100% 100%, 7% 100%, 0 84%);
  background:
    linear-gradient(145deg, rgba(7, 12, 20, 0.88), rgba(6, 16, 30, 0.74)),
    radial-gradient(circle at 84% -8%, rgba(255, 255, 255, 0.26), transparent 36%),
    repeating-linear-gradient(0deg, rgba(167, 222, 255, 0.08) 0 1px, transparent 1px 13px);
  backdrop-filter: blur(10px);
  box-shadow:
    0 0 54px rgba(0, 0, 0, 0.48),
    0 0 24px rgba(122, 231, 255, 0.24) inset,
    0 0 32px rgba(255, 255, 255, 0.2);
  transition: transform 420ms cubic-bezier(0.2, 0.85, 0.2, 1), opacity 280ms ease;
}

.info-panel::before {
  content: "";
  position: absolute;
  inset: 10px 12px;
  border: 1px solid rgba(229, 249, 255, 0.28);
  pointer-events: none;
}

.info-panel::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 14px;
  width: 82px;
  height: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.9);
  border-right: 1px solid rgba(255, 255, 255, 0.9);
  opacity: 0.8;
}

.info-panel h2 {
  font-family: "Orbitron", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 1.12rem;
  margin: 0 0 0.75rem;
}

.panel-tag {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.12em;
  font-weight: 700;
  font-size: 0.72rem;
}

.info-panel p {
  margin: 0.45rem 0;
  line-height: 1.32;
  font-size: 1rem;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: clamp(14px, 4vw, 30px);
  margin: 0;
  transform: translateX(-50%);
  color: rgba(219, 244, 255, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: clamp(0.72rem, 1.6vw, 0.95rem);
  text-shadow: 0 0 12px rgba(134, 216, 255, 0.3);
  transition: opacity 320ms ease;
}

.hud.active .hint {
  opacity: 0.1;
}

.hud.active .reticle {
  border-color: rgba(255, 192, 120, 0.8);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.07) inset,
    0 0 36px rgba(255, 177, 96, 0.45);
}

.hud.active .info-panel {
  transform: translate(0, -50%);
  opacity: 1;
}

@media (max-width: 760px) {
  .top-actions {
    left: 10px;
    right: 10px;
    align-items: stretch;
    top: 82px;
  }

  .contract-card {
    width: 100%;
  }

  .community-links {
    justify-content: flex-start;
  }

  .info-panel {
    top: auto;
    bottom: 76px;
    transform: translate(0, 130%);
    right: 50%;
    left: 50%;
    width: min(480px, 92vw);
    translate: -50% 0;
  }

  .hud.active .info-panel {
    transform: translate(0, 0);
  }
}

@keyframes scan {
  0% {
    transform: translateY(-15%);
  }
  100% {
    transform: translateY(430%);
  }
}

@keyframes drift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-2%, 2%, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.78;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04);
  }
}

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

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

@keyframes flare {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.25);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.15);
  }
}

@keyframes poly-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.45);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.86);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.18);
  }
}

@keyframes draw-main {
  from {
    stroke-dashoffset: 420;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes draw-accent {
  from {
    stroke-dashoffset: 300;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes draw-scan {
  from {
    stroke-dashoffset: 172;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes beam-fire {
  0% {
    opacity: 0;
    filter: brightness(0.7);
  }
  24% {
    opacity: 1;
    filter: brightness(1.7);
  }
  100% {
    opacity: 0;
    filter: brightness(1);
  }
}

@keyframes link-scan {
  0% {
    transform: translateX(-108%);
  }
  100% {
    transform: translateX(108%);
  }
}
