.nh-route-demo {
  --nh-border: rgba(148,163,184,.16);
  --nh-green: #34d399;
  position: relative;
  width: 100%;
  max-width: 620px;
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid var(--nh-border);
  border-radius: 2rem;
  background:
    radial-gradient(circle at 70% 15%, rgba(99,102,241,.16), transparent 30%),
    linear-gradient(180deg, rgba(15,23,42,.92), rgba(2,6,23,.88));
  box-shadow: 0 28px 80px rgba(2,6,23,.42);
  padding: 1.4rem;
  isolation: isolate;
}

.nh-route-demo::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .4;
  background-image:
    linear-gradient(rgba(99,102,241,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,.055) 1px, transparent 1px);
  background-size: 28px 28px;
}

.nh-route-demo__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .55rem;
}

.nh-route-demo__eyebrow {
  margin: 0;
  color: #a5b4fc;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.nh-route-demo__title {
  margin: .28rem 0 0;
  color: #f8fafc;
  font-size: clamp(1.05rem, 2vw, 1.32rem);
  font-weight: 800;
}

.nh-route-demo__status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: .45rem;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 999px;
  background: rgba(2,6,23,.6);
  padding: .45rem .65rem;
  color: #cbd5e1;
  font-size: .72rem;
  font-weight: 700;
}

.nh-route-demo__status-dot {
  width: .48rem;
  height: .48rem;
  border-radius: 999px;
  background: #64748b;
  box-shadow: 0 0 0 4px rgba(100,116,139,.1);
  transition: background-color 260ms ease, box-shadow 260ms ease;
}

.nh-route-demo[data-state="on"] .nh-route-demo__status-dot {
  background: var(--nh-green);
  box-shadow: 0 0 0 4px rgba(52,211,153,.12);
}

.nh-route-demo__desktop { display: block; }
.nh-route-demo__mobile { display: none; }
.nh-route-map { display: block; width: 100%; height: auto; overflow: visible; }
.nh-world-map { fill: rgba(100,116,139,.12); stroke: rgba(148,163,184,.14); stroke-width: 1.3; }
.nh-route-line { fill: none; stroke-linecap: round; stroke-width: 5; }
.nh-route-line--direct { stroke: rgba(148,163,184,.58); stroke-dasharray: 5 9; transition: opacity 300ms ease; }
.nh-route-line--secure { stroke: url("#nhSecureGradient"); opacity: 0; stroke-dasharray: 100; stroke-dashoffset: 100; }
.nh-route-demo[data-state="on"] .nh-route-line--direct { opacity: .13; }
.nh-route-demo[data-state="on"] .nh-route-line--secure-a { opacity: 1; animation: nh-route-draw 680ms ease forwards; }
.nh-route-demo[data-state="on"] .nh-route-line--secure-b { opacity: 1; animation: nh-route-draw 680ms 480ms ease forwards; }
.nh-pin-halo { fill: rgba(129,140,248,.1); stroke: rgba(129,140,248,.12); }
.nh-pin { fill: #312e81; stroke: #818cf8; stroke-width: 2; }
.nh-pin--destination { fill: #172554; }
.nh-person-head, .nh-person-body, .nh-building { fill: #e0e7ff; }
.nh-map-label { fill: #cbd5e1; font-size: 14px; font-weight: 700; }
.nh-block-marker { fill: #ef4444; opacity: 1; transform-origin: center; transition: opacity 250ms ease, transform 250ms ease; }
.nh-block-marker rect { fill: #fff; }
.nh-block-copy { fill: #fca5a5; font-size: 10px; font-weight: 800; letter-spacing: .14em; opacity: 1; transition: opacity 250ms ease; }
.nh-route-demo[data-state="on"] .nh-block-marker { opacity: 0; transform: scale(.8); }
.nh-route-demo[data-state="on"] .nh-block-copy { opacity: 0; }
.nh-wire-node { opacity: .35; transition: opacity 300ms ease, filter 300ms ease; }
.nh-wire-node__halo { fill: rgba(99,102,241,.1); }
.nh-wire-node__circle { fill: #4f46e5; stroke: #a5b4fc; stroke-width: 2; }
.nh-wire-node__n { fill: #fff; font-size: 24px; font-weight: 900; }
.nh-wire-copy { fill: #a5b4fc; font-size: 10px; font-weight: 900; letter-spacing: .16em; opacity: .48; transition: opacity 250ms ease; }
.nh-route-demo[data-state="on"] .nh-wire-node { opacity: 1; filter: url("#nhGlow"); }
.nh-route-demo[data-state="on"] .nh-wire-copy { opacity: 1; }
.nh-lock { fill: none; stroke: #a7f3d0; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.6; opacity: 0; transform-origin: center; }
.nh-route-demo[data-state="on"] .nh-lock { animation: nh-lock-in 360ms 980ms ease forwards; }

.nh-service-row { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .55rem; margin-top: -.5rem; }
.nh-service-chip { display: flex; align-items: center; justify-content: center; gap: .42rem; min-height: 2.6rem; border: 1px solid rgba(148,163,184,.13); border-radius: .9rem; background: rgba(2,6,23,.48); color: #cbd5e1; font-size: .76rem; font-weight: 700; transition: border-color 300ms ease, background-color 300ms ease, color 300ms ease; }
.nh-service-chip i { color: #94a3b8; transition: color 300ms ease; }
.nh-route-demo[data-state="on"] .nh-service-chip { border-color: rgba(52,211,153,.24); background: rgba(6,78,59,.15); color: #d1fae5; }
.nh-route-demo[data-state="on"] .nh-service-chip i { color: #6ee7b7; }

.nh-route-demo__message { min-height: 4.6rem; margin-top: 1rem; border-top: 1px solid rgba(148,163,184,.12); padding-top: 1rem; color: #94a3b8; font-size: .8rem; line-height: 1.55; }
.nh-route-demo__message p { margin: 0; }
.nh-route-demo__message strong { display: block; margin-bottom: .2rem; color: #e2e8f0; font-size: .88rem; }
.nh-state-on { display: none; }
.nh-route-demo[data-state="on"] .nh-state-off { display: none; }
.nh-route-demo[data-state="on"] .nh-state-on { display: inline; }
.nh-route-demo__message .nh-state-on { display: none; }
.nh-route-demo[data-state="on"] .nh-route-demo__message .nh-state-on { display: block; }

.nh-route-toggle { display: flex; width: 100%; align-items: center; gap: .8rem; margin-top: .8rem; border: 1px solid rgba(129,140,248,.25); border-radius: 1rem; background: rgba(49,46,129,.18); padding: .72rem .8rem; color: #fff; cursor: pointer; text-align: left; transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease; }
.nh-route-toggle:hover { transform: translateY(-1px); border-color: rgba(129,140,248,.42); background: rgba(49,46,129,.26); }
.nh-route-toggle:focus-visible { outline: 3px solid rgba(129,140,248,.42); outline-offset: 3px; }
.nh-route-toggle__switch { position: relative; width: 2.85rem; height: 1.55rem; flex: 0 0 auto; border-radius: 999px; background: #334155; transition: background-color 260ms ease; }
.nh-route-toggle__knob { position: absolute; top: .2rem; left: .2rem; width: 1.15rem; height: 1.15rem; border-radius: 999px; background: #f8fafc; box-shadow: 0 4px 12px rgba(2,6,23,.38); transition: transform 260ms ease; }
.nh-route-demo[data-state="on"] .nh-route-toggle__switch { background: #059669; }
.nh-route-demo[data-state="on"] .nh-route-toggle__knob { transform: translateX(1.3rem); }
.nh-route-toggle__copy { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: .7rem; flex: 1; }
.nh-route-toggle__copy strong { font-size: .88rem; }
.nh-route-toggle__copy > span { color: #a5b4fc; font-size: .76rem; font-weight: 800; }
.nh-route-demo[data-state="on"] .nh-route-toggle__copy > .nh-state-on { color: #6ee7b7; }
.nh-route-demo__disclaimer { margin: .7rem 0 0; color: #64748b; font-size: .68rem; line-height: 1.45; text-align: center; }

@keyframes nh-route-draw { to { stroke-dashoffset: 0; } }
@keyframes nh-lock-in { from { opacity: 0; transform: scale(.72); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 639px) {
  .nh-route-demo { border-radius: 1.5rem; padding: 1.05rem; }
  .nh-route-demo__top { align-items: center; }
  .nh-route-demo__status { padding: .38rem .52rem; font-size: .64rem; }
  .nh-route-demo__desktop { display: none; }
  .nh-route-demo__mobile { display: block; margin-top: 1rem; }
  .nh-mobile-route { display: grid; justify-items: center; }
  .nh-mobile-route__node { display: flex; width: min(100%,18rem); align-items: center; gap: .75rem; border: 1px solid rgba(148,163,184,.14); border-radius: 1rem; background: rgba(2,6,23,.46); padding: .72rem .8rem; color: #e2e8f0; }
  .nh-mobile-route__node strong, .nh-mobile-route__node small { display: block; }
  .nh-mobile-route__node strong { font-size: .82rem; }
  .nh-mobile-route__node small { margin-top: .1rem; color: #94a3b8; font-size: .72rem; }
  .nh-mobile-route__icon, .nh-mobile-route__brand { display: grid; width: 2.2rem; height: 2.2rem; flex: 0 0 auto; place-items: center; border-radius: .75rem; background: rgba(79,70,229,.24); color: #c7d2fe; }
  .nh-mobile-route__brand { background: #4f46e5; color: #fff; font-weight: 900; }
  .nh-mobile-route__connector { display: grid; min-height: 5.2rem; justify-items: center; }
  .nh-mobile-route__line { display: block; width: 2px; height: 2.5rem; background: #475569; }
  .nh-mobile-route__warning { display: inline-flex; align-items: center; gap: .4rem; border-radius: 999px; background: rgba(127,29,29,.2); padding: .35rem .58rem; color: #fca5a5; font-size: .68rem; font-weight: 700; }
  .nh-mobile-route__connector--secure { display: none; }
  .nh-route-demo[data-state="on"] .nh-mobile-route__connector--direct { display: none; }
  .nh-route-demo[data-state="on"] .nh-mobile-route__connector--secure { display: grid; }
  .nh-route-demo[data-state="on"] .nh-mobile-route__connector--secure .nh-mobile-route__line { background: linear-gradient(#818cf8,#34d399); }
  .nh-mobile-route__wire { display: flex; align-items: center; gap: .68rem; border: 1px solid rgba(52,211,153,.2); border-radius: .95rem; background: rgba(6,78,59,.18); padding: .55rem .72rem; color: #ecfdf5; }
  .nh-mobile-route__wire strong, .nh-mobile-route__wire small { display: block; }
  .nh-mobile-route__wire strong { font-size: .78rem; }
  .nh-mobile-route__wire small { margin-top: .08rem; color: #a7f3d0; font-size: .67rem; }
  .nh-route-demo__message { min-height: 5.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .nh-route-demo *, .nh-route-demo *::before, .nh-route-demo *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
