/* HAND/OS — premium neural signal overlay
   Compact hero + narrow top-right HUD */

html {
  scrollbar-gutter: stable;
}

body {
  min-height: 100svh;
}

.shell {
  width: min(100%, 820px);
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  padding-bottom: max(42px, env(safe-area-inset-bottom));
}

.hero {
  padding: clamp(14px, 3vw, 18px);
}

/* =========================================================
   COMPACT HERO
   ========================================================= */

.hero-compact {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-live-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  min-height: 34px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(121, 255, 208, 0.18);
  background: rgba(121, 255, 208, 0.05);
  color: #dffff3;
  font: 900 10px ui-monospace, SFMono-Regular, monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 0 0 4px rgba(121, 255, 208, 0.10),
    0 0 12px rgba(121, 255, 208, 0.55);
}

.is-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.hidden-action {
  display: none !important;
}

.scan-strip {
  margin: 6px 0 6px;
}

.connect,
.payload-action {
  min-height: 54px;
}

/* =========================================================
   X-RAY SCENE
   ========================================================= */

.xray-scene {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  margin: 0;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(123, 191, 255, 0.18);
  background: #02060c;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.03),
    0 28px 80px rgba(0,0,0,0.42);
  isolation: isolate;
}

.xray-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center center;
  z-index: 1;
  filter:
    saturate(1.03)
    contrast(1.02)
    brightness(0.98);
}

/* =========================================================
   HUD — SINGLE COMPACT PANEL, TOP RIGHT ONLY
   ========================================================= */

.xray-hud-stack {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  pointer-events: none;
}

.xray-tag {
  position: relative;
  width: 92px;
  min-width: 92px;
  max-width: 92px;
  padding: 7px 7px;
  border-radius: 13px;
  border: 1px solid rgba(132,216,255,0.14);
  background: rgba(3,10,18,0.56);
  backdrop-filter: blur(8px) saturate(1.05);
  -webkit-backdrop-filter: blur(8px) saturate(1.05);
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}

.xray-tag-summary {
  display: grid;
  gap: 5px;
}

.hud-row {
  display: flex;
  align-items: baseline;
  gap: 3px;
  min-width: 0;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.05;
}

.hud-key {
  flex: 0 0 auto;
  color: #718e9e;
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.10em;
}

.hud-value {
  min-width: 0;
  color: #dcfbff;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.025em;
}

/* =========================================================
   NEURAL MASK LAYERS
   ========================================================= */

.neural-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url('/xray-hand-network-mask.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
}

.neural-base {
  z-index: 2;
  opacity: 0.22;
  mix-blend-mode: screen;
  filter:
    saturate(1.32)
    brightness(1.24)
    contrast(1.36)
    blur(0.45px);
  animation: neuralMaskPulse 6.8s linear infinite;
}

.neural-glow {
  z-index: 3;
  opacity: 0.16;
  mix-blend-mode: screen;
  filter:
    blur(10px)
    saturate(1.45)
    brightness(1.42)
    contrast(1.12);
  animation:
    neuralGlowBreath 3.8s ease-in-out infinite,
    neuralMaskGlowPulse 6.8s linear infinite;
}

/* =========================================================
   MOVING SIGNAL LAYERS
   ========================================================= */

.neural-signal {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.88;
  mix-blend-mode: screen;
  -webkit-mask-image: url('/xray-hand-network-mask.png');
  mask-image: url('/xray-hand-network-mask.png');
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center center;
  mask-position: center center;
  -webkit-mask-size: contain;
  mask-size: contain;
  background-repeat: no-repeat;
  filter:
    saturate(1.42)
    brightness(1.20)
    contrast(1.28)
    blur(0.28px);
}

.neural-signal-a {
  opacity: 0.86;
  background-image:
    radial-gradient(
      circle at 65% 73%,
      rgba(255,224,118,0) 0 1%,
      rgba(255,224,118,0.32) 3.8%,
      rgba(255,110,208,0.18) 8%,
      transparent 16%
    ),
    linear-gradient(
      114deg,
      transparent 16%,
      rgba(255,78,196,0) 28%,
      rgba(255,78,196,0.18) 36%,
      rgba(255,78,196,0.64) 44%,
      rgba(255,210,96,0.82) 49%,
      rgba(111,255,244,0.84) 54%,
      rgba(255,117,208,0.66) 60%,
      rgba(255,78,196,0.24) 67%,
      rgba(255,78,196,0) 74%,
      transparent 84%
    );
  background-size: 100% 100%, 185% 185%;
  background-position: center center, -16% 118%;
  animation: neuralSweepOne 4s linear infinite;
}

.neural-signal-b {
  opacity: 0.58;
  background-image:
    linear-gradient(
      104deg,
      transparent 22%,
      rgba(255,132,214,0) 35%,
      rgba(255,132,214,0.14) 42%,
      rgba(255,232,132,0.54) 49%,
      rgba(120,255,246,0.66) 54%,
      rgba(255,132,214,0.52) 59%,
      rgba(255,132,214,0.12) 66%,
      rgba(255,132,214,0) 74%,
      transparent 82%
    );
  background-size: 170% 170%;
  background-position: 122% -8%;
  animation: neuralSweepTwo 5.4s linear infinite;
}

.neural-signal-c {
  opacity: 0.62;
  background-image:
    radial-gradient(
      ellipse 20% 16% at 65% 73%,
      rgba(255,220,110,0.72) 0%,
      rgba(255,135,220,0.34) 16%,
      rgba(108,255,248,0.16) 34%,
      rgba(108,255,248,0) 56%
    );
  background-size: 100% 100%;
  background-position: center center;
  animation: implantBloom 3.1s ease-in-out infinite;
}

/* =========================================================
   VIGNETTE / SCAN / ATMOSPHERE
   ========================================================= */

.xray-vignette {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(circle at center, transparent 65%, rgba(0,0,0,0.16) 100%),
    linear-gradient(180deg, rgba(3,8,15,0), rgba(3,8,15,0.08));
}

.xray-scanbeam {
  position: absolute;
  inset: -45% 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  background:
    linear-gradient(
      180deg,
      transparent 45%,
      rgba(146,233,255,0.008) 49%,
      rgba(146,233,255,0.026) 50%,
      rgba(146,233,255,0.008) 51%,
      transparent 55%
    );
  transform: translateY(-68%);
  animation: xrayScanSweep 14s ease-in-out infinite;
}

.xray-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  mix-blend-mode: screen;
  background:
    radial-gradient(
      ellipse 14% 12% at 65% 73%,
      rgba(255,137,222,0.12),
      transparent 72%
    ),
    radial-gradient(
      ellipse 22% 18% at 65% 73%,
      rgba(88,245,255,0.065),
      transparent 78%
    );
  animation: localBreath 3.8s ease-in-out infinite;
}

.xray-chip-aura {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  mix-blend-mode: screen;
  background:
    radial-gradient(
      ellipse 6.2% 5.4% at 65% 73%,
      rgba(255,210,118,0.36),
      rgba(255,116,208,0.18) 34%,
      rgba(87,247,255,0.06) 62%,
      transparent 100%
    );
  animation: chipAuraBreath 2.9s ease-in-out infinite;
}

/* =========================================================
   CHIP
   ========================================================= */

.chip-pulse-group {
  position: absolute;
  z-index: 9;
  left: 65%;
  top: 73%;
  width: 0;
  height: 0;
  pointer-events: none;
}

.chip-core,
.chip-ring {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
}

.chip-core {
  width: 12px;
  height: 27px;
  border-radius: 999px;
  transform: translate(-50%, -50%) rotate(24deg);
  background: rgba(255,218,132,0.055);
  border: 1px solid rgba(255,207,107,0.18);
  box-shadow:
    0 0 9px rgba(255,204,87,0.26),
    0 0 18px rgba(255,104,198,0.16),
    0 0 28px rgba(87,247,255,0.10);
  animation: chipGlowSoft 2.9s ease-in-out infinite;
}

.chip-ring {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,160,214,0.18);
  border-radius: 54% 46% 58% 42% / 45% 55% 43% 57%;
  box-shadow: 0 0 10px rgba(87,247,255,0.14);
  opacity: 0;
}

.chip-ring-a {
  animation: chipRingOne 4.6s ease-out infinite;
}

.chip-ring-b {
  animation: chipRingTwo 4.6s ease-out infinite 0.8s;
}

/* =========================================================
   IMPLANT INFO SECTION
   ========================================================= */

.implant {
  grid-template-columns: 1fr !important;
  padding: 22px !important;
  gap: 16px;
}

.implant p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
}

.chip-spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.chip-spec {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,0.02);
}

.chip-spec small,
.chip-spec strong,
.chip-spec span {
  display: block;
}

.chip-spec small {
  font: 800 9px ui-monospace, monospace;
  letter-spacing: 0.13em;
  color: var(--accent);
  margin-bottom: 7px;
}

.chip-spec strong {
  font-size: 0.92rem;
  line-height: 1.35;
  margin-bottom: 6px;
}

.chip-spec span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

/* =========================================================
   CONSOLE HELPERS
   ========================================================= */

.console-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.console-live {
  font: 800 9px ui-monospace, monospace;
  color: var(--accent);
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.roadmap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.roadmap-grid > div {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.02);
}

.roadmap-grid strong,
.roadmap-grid small {
  display: block;
}

.roadmap-grid strong {
  font-size: 0.75rem;
  letter-spacing: 0.07em;
}

.roadmap-grid small {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.4;
}

/* =========================================================
   ANIMATIONS
   ========================================================= */

@keyframes neuralMaskPulse {
  0%   { opacity: 0.03; }
  6%   { opacity: 0.10; }
  13%  { opacity: 0.34; }
  19%  { opacity: 0.16; }
  27%  { opacity: 0.52; }
  33%  { opacity: 0.24; }
  41%  { opacity: 0.68; }
  49%  { opacity: 0.18; }
  57%  { opacity: 0.44; }
  63%  { opacity: 0.12; }
  71%  { opacity: 0.74; }
  79%  { opacity: 0.22; }
  87%  { opacity: 0.58; }
  94%  { opacity: 0.14; }
  100% { opacity: 0.03; }
}

@keyframes neuralMaskGlowPulse {
  0%   { opacity: 0.05; }
  8%   { opacity: 0.14; }
  15%  { opacity: 0.28; }
  22%  { opacity: 0.10; }
  31%  { opacity: 0.34; }
  39%  { opacity: 0.18; }
  46%  { opacity: 0.44; }
  54%  { opacity: 0.12; }
  62%  { opacity: 0.36; }
  71%  { opacity: 0.09; }
  80%  { opacity: 0.46; }
  89%  { opacity: 0.18; }
  100% { opacity: 0.05; }
}

@keyframes neuralGlowBreath {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.012); }
}

@keyframes neuralSweepOne {
  0%   { background-position: center center, -16% 118%; opacity: 0.18; }
  18%  { opacity: 0.44; }
  42%  { opacity: 0.86; }
  68%  { opacity: 0.56; }
  100% { background-position: center center, 116% -14%; opacity: 0.18; }
}

@keyframes neuralSweepTwo {
  0%   { background-position: 122% -8%; opacity: 0.08; }
  20%  { opacity: 0.22; }
  48%  { opacity: 0.58; }
  76%  { opacity: 0.28; }
  100% { background-position: -18% 118%; opacity: 0.08; }
}

@keyframes implantBloom {
  0%, 100% {
    opacity: 0.22;
    transform: scale(0.97);
  }
  40% {
    opacity: 0.62;
    transform: scale(1.02);
  }
  64% {
    opacity: 0.34;
    transform: scale(1.04);
  }
}

@keyframes xrayScanSweep {
  0% {
    transform: translateY(-68%);
    opacity: 0;
  }
  26% { opacity: 0; }
  40% { opacity: 0.06; }
  52% { opacity: 0.025; }
  66% { opacity: 0; }
  100% {
    transform: translateY(68%);
    opacity: 0;
  }
}

@keyframes localBreath {
  0%, 100% { opacity: 0.72; }
  50%      { opacity: 1; }
}

@keyframes chipAuraBreath {
  0%, 100% { opacity: 0.58; }
  48%      { opacity: 1; }
}

@keyframes chipGlowSoft {
  0%, 100% {
    opacity: 0.44;
    box-shadow:
      0 0 8px rgba(255,198,79,0.20),
      0 0 16px rgba(255,101,194,0.10),
      0 0 24px rgba(87,247,255,0.07);
  }
  48% {
    opacity: 0.86;
    box-shadow:
      0 0 12px rgba(255,220,118,0.38),
      0 0 22px rgba(255,101,194,0.18),
      0 0 32px rgba(87,247,255,0.12);
  }
}

@keyframes chipRingOne {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.58) rotate(6deg);
  }
  18% { opacity: 0.20; }
  44% { opacity: 0.10; }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.58) rotate(18deg);
  }
}

@keyframes chipRingTwo {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.64) rotate(-8deg);
  }
  18% { opacity: 0.16; }
  44% { opacity: 0.08; }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.46) rotate(-16deg);
  }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 560px) {
  .shell {
    padding-top: 8px;
  }

  .hero {
    border-radius: 24px;
    padding: 14px 14px 16px;
  }

  .hero-live-strip {
    min-height: 32px;
    padding: 7px 12px;
    font-size: 9px;
  }

  .xray-scene {
    width: 100%;
    border-radius: 22px;
    aspect-ratio: 4 / 5;
  }

  .xray-hud-stack {
    top: 8px;
    right: 8px;
  }

  .xray-tag {
    width: 84px;
    min-width: 84px;
    max-width: 84px;
    padding: 6px 6px;
  }

  .xray-tag-summary {
    gap: 4px;
  }

  .hud-row {
    gap: 4px;
  }

  .hud-key {
    font-size: 5px;
  }

  .hud-value {
    font-size: 6.5px;
  }

  .neural-base {
    filter:
      saturate(1.46)
      brightness(1.34)
      contrast(1.46)
      blur(0.58px);
  }

  .neural-glow {
    filter:
      blur(10px)
      saturate(1.58)
      brightness(1.52)
      contrast(1.16);
  }

  .neural-signal {
    filter:
      saturate(1.54)
      brightness(1.28)
      contrast(1.38)
      blur(0.38px);
  }

  .scan-strip {
    margin: 4px 0 4px;
  }

  .scan-strip > div {
    padding: 12px 0;
  }

  .connect,
  .payload-action {
    min-height: 50px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .card {
    min-height: 96px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
  }

  .card .icon {
    min-width: 30px;
  }

  .live,
  .payload,
  .implant,
  .owner-card {
    border-radius: 22px;
  }

  .implant {
    padding: 18px !important;
    gap: 18px;
  }

  .chip-spec-grid {
    grid-template-columns: 1fr;
  }

  footer {
    padding-top: 18px;
    gap: 12px;
    flex-wrap: wrap;
  }

  .console-hero {
    display: block;
  }

  .console-live {
    display: inline-block;
    margin-top: 14px;
  }

  .roadmap-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .neural-glow,
  .neural-signal,
  .xray-scanbeam,
  .xray-atmosphere,
  .xray-chip-aura,
  .chip-core,
  .chip-ring {
    animation: none !important;
  }

  .neural-base {
    opacity: 0.62;
  }

  .neural-glow {
    opacity: 0.34;
  }

  .neural-signal-a {
    opacity: 0.36;
  }

  .neural-signal-b {
    opacity: 0.24;
  }

  .neural-signal-c {
    opacity: 0.30;
  }
}
