:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f6fff9;
  background: #050807;
  --bg: #050807;
  --ink: #f6fff9;
  --muted: #9eb9af;
  --muted-2: #6f8c82;
  --line: rgba(186, 255, 220, 0.18);
  --line-strong: rgba(186, 255, 220, 0.34);
  --panel: rgba(6, 14, 12, 0.74);
  --panel-strong: rgba(9, 24, 20, 0.86);
  --green: #38f5a5;
  --cyan: #36dcd4;
  --amber: #ffd166;
  --coral: #ff7d6f;
  --shadow: rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 38px 18px;
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(5, 8, 7, 0.98) 0%, rgba(5, 22, 18, 0.92) 38%, rgba(29, 22, 14, 0.88) 100%),
    #050807;
}

.route-canvas {
  position: fixed;
  inset: 0;
  z-index: -4;
  width: 100vw;
  height: 100vh;
}

.surface-grid,
.signal-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.surface-grid {
  z-index: -3;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(135deg, rgba(56, 245, 165, 0.12), transparent 28%),
    linear-gradient(315deg, rgba(255, 125, 111, 0.13), transparent 30%);
  background-size: 84px 84px, 84px 84px, 100% 100%, 100% 100%;
  mask-image: radial-gradient(circle at 50% 50%, #000 0 72%, transparent 100%);
}

.signal-lines {
  z-index: -2;
  overflow: hidden;
}

.signal-lines span {
  position: absolute;
  left: -16vw;
  width: 132vw;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 245, 165, 0.54), rgba(54, 220, 212, 0.48), transparent);
  box-shadow: 0 0 24px rgba(56, 245, 165, 0.28);
  animation: signal-slide 9s linear infinite;
}

.signal-lines span:nth-child(1) {
  top: 24%;
  transform: rotate(-8deg);
}

.signal-lines span:nth-child(2) {
  top: 54%;
  transform: rotate(0deg);
  animation-duration: 12s;
}

.signal-lines span:nth-child(3) {
  top: 78%;
  transform: rotate(11deg);
  animation-duration: 14s;
  background: linear-gradient(90deg, transparent, rgba(255, 209, 102, 0.48), rgba(255, 125, 111, 0.38), transparent);
}

.access-shell {
  width: min(1120px, calc(100vw - 36px));
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.026)),
    var(--panel);
  box-shadow:
    0 40px 120px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(26px) saturate(1.12);
  overflow: hidden;
}

.access-shell::before {
  content: "";
  display: block;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--green), var(--cyan), var(--amber), transparent);
  animation: header-scan 7s ease-in-out infinite;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 30px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(56, 245, 165, 0.08), transparent 44%),
    rgba(255, 255, 255, 0.032);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(56, 245, 165, 0.46);
  border-radius: 8px;
  color: #02100c;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  box-shadow: 0 0 34px rgba(56, 245, 165, 0.34);
  font-weight: 950;
  font-size: 20px;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(56, 245, 165, 0.18);
  border-radius: 8px;
  animation: mark-pulse 3.8s ease-in-out infinite;
}

.brand-copy p,
.kicker,
.endpoint,
.muted,
.message,
.route-value,
.profile-card em,
.profile-card small {
  color: var(--muted);
}

.brand-copy p,
.kicker {
  margin: 0 0 7px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 54px);
  line-height: 0.96;
}

h2 {
  font-size: clamp(28px, 3.4vw, 46px);
  line-height: 1.02;
}

.endpoint {
  max-width: 45%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(186, 255, 220, 0.18);
  border-radius: 8px;
  padding: 10px 13px;
  background: rgba(1, 8, 7, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.endpoint-light {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  background: var(--green);
  box-shadow: 0 0 18px rgba(56, 245, 165, 0.82);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(430px, 1.05fr);
  min-height: 560px;
}

.command-panel,
.credential-panel {
  min-width: 0;
  padding: 34px 30px;
}

.command-panel {
  display: grid;
  align-content: space-between;
  gap: 30px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(56, 245, 165, 0.075), transparent 48%),
    rgba(2, 10, 8, 0.2);
}

.panel-heading {
  max-width: 420px;
}

.lookup-form,
.subscription-card {
  display: grid;
  gap: 11px;
}

label {
  color: #eafff4;
  font-size: 14px;
  font-weight: 850;
}

.control-row,
.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 148px;
  gap: 10px;
  min-width: 0;
}

input {
  width: 100%;
  min-width: 0;
  height: 56px;
  border: 1px solid rgba(186, 255, 220, 0.25);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)),
    rgba(1, 8, 7, 0.7);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-overflow: ellipsis;
}

input::placeholder {
  color: rgba(158, 185, 175, 0.66);
}

input:focus {
  border-color: rgba(56, 245, 165, 0.74);
  box-shadow:
    0 0 0 4px rgba(56, 245, 165, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.primary-action,
.secondary-action {
  position: relative;
  height: 56px;
  border: 1px solid rgba(56, 245, 165, 0.45);
  border-radius: 8px;
  padding: 0 18px;
  color: #03100d;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  box-shadow: 0 20px 44px rgba(56, 245, 165, 0.18);
  font-weight: 950;
  overflow: hidden;
}

.primary-action::before,
.secondary-action::before {
  content: "";
  position: absolute;
  inset: 0;
  translate: -120% 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  transition: translate 0.55s ease;
}

.primary-action:hover::before,
.secondary-action:hover::before {
  translate: 120% 0;
}

.primary-action:disabled {
  filter: grayscale(0.35) brightness(0.72);
  cursor: progress;
}

.route-board {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(186, 255, 220, 0.16);
  border-radius: 8px;
  padding: 16px;
  background: rgba(1, 8, 7, 0.42);
}

.route-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  min-height: 30px;
}

.route-label,
.route-value {
  font-size: 12px;
  font-weight: 850;
}

.route-path {
  position: relative;
  height: 1px;
  background: rgba(186, 255, 220, 0.17);
  overflow: hidden;
}

.route-path::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 44%;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  animation: path-flow 2.8s linear infinite;
}

.credential-panel {
  display: grid;
  align-content: start;
  gap: 26px;
  background:
    linear-gradient(145deg, rgba(54, 220, 212, 0.06), transparent 36%),
    rgba(0, 0, 0, 0.14);
}

.credential-panel[hidden] {
  display: none;
}

.credential-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.credential-head h2 {
  margin-bottom: 7px;
}

.live-badge {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(56, 245, 165, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
  color: #aaffd2;
  background: rgba(56, 245, 165, 0.08);
  font-size: 12px;
  font-weight: 900;
}

.credential-body {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.qr-card,
.subscription-card,
.profile-card {
  border: 1px solid rgba(186, 255, 220, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.064), rgba(255, 255, 255, 0.022)),
    rgba(2, 10, 8, 0.54);
}

.qr-card {
  min-height: 184px;
  display: grid;
  place-items: center;
  padding: 17px;
}

#qr {
  width: 150px;
  height: 150px;
  display: block;
  border-radius: 8px;
  background: #f6fff9;
  padding: 8px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.subscription-card {
  padding: 16px;
  align-content: center;
}

.profiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-card {
  min-height: 92px;
  display: grid;
  gap: 10px;
  align-content: center;
  padding: 16px;
  overflow: hidden;
}

.profile-card.smart {
  border-color: rgba(56, 245, 165, 0.36);
}

.profile-card.moscow {
  border-color: rgba(255, 209, 102, 0.32);
}

.profile-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.profile-card strong {
  color: var(--ink);
  font-size: 18px;
}

.profile-card small,
.profile-card em {
  font-size: 12px;
  font-style: normal;
}

.message {
  min-height: 22px;
  font-size: 14px;
  font-weight: 850;
}

.error {
  color: #ffb0a4;
}

.success {
  color: #aaffd2;
}

.is-loading .route-path::after {
  animation-duration: 0.9s;
}

@keyframes signal-slide {
  0% {
    translate: -12% 0;
    opacity: 0.16;
  }
  44% {
    opacity: 0.72;
  }
  100% {
    translate: 12% 0;
    opacity: 0.18;
  }
}

@keyframes header-scan {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@keyframes mark-pulse {
  0%,
  100% {
    scale: 1;
    opacity: 0.34;
  }
  50% {
    scale: 1.12;
    opacity: 0.76;
  }
}

@keyframes path-flow {
  0% {
    translate: -110% 0;
  }
  100% {
    translate: 260% 0;
  }
}

@media (max-width: 900px) {
  .stage {
    place-items: start center;
    padding: 18px;
  }

  .access-shell {
    width: min(100%, 720px);
  }

  .topbar,
  .content-grid,
  .credential-body {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    padding: 24px;
  }

  .endpoint {
    max-width: 100%;
  }

  .content-grid {
    display: grid;
    min-height: 0;
  }

  .command-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .command-panel,
  .credential-panel {
    padding: 24px;
  }

  .qr-card {
    width: 184px;
  }
}

@media (max-width: 560px) {
  .stage {
    padding: 10px;
    place-items: start;
  }

  .access-shell {
    width: min(360px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
  }

  .topbar,
  .command-panel,
  .credential-panel {
    padding: 20px;
  }

  .brand-mark {
    width: 52px;
    height: 52px;
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 26px;
  }

  .control-row,
  .copy-row,
  .profiles {
    grid-template-columns: 1fr;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .route-row {
    grid-template-columns: 54px minmax(24px, 1fr) minmax(46px, 54px);
  }

  .route-value {
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .route-board {
    display: none;
  }

  .credential-head {
    display: grid;
  }

  .credential-body {
    gap: 14px;
  }

  .qr-card {
    width: 170px;
    min-height: 170px;
  }

  #qr {
    width: 140px;
    height: 140px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
