:root {
  --wd-bg: #05070b;
  --wd-surface: #0b1019;
  --wd-surface-2: #121927;
  --wd-tile: rgba(255, 255, 255, 0.045);
  --wd-line: rgba(255, 255, 255, 0.11);
  --wd-ink: #f5f5f4;
  --wd-ink-2: #c8cedb;
  --wd-ink-3: #959dad;
  --wd-orange: #f97316;
  --wd-orange-2: #fb923c;
  --wd-blue: #0052ff;
  --wd-blue-soft: #93c5fd;
  --wd-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html.rex-wd-lock,
body.rex-wd-lock {
  overflow: hidden;
  height: 100%;
}

.rex-wd-backdrop,
.rex-wd-backdrop *,
.rex-wd-backdrop *::before,
.rex-wd-backdrop *::after {
  box-sizing: border-box;
}

.rex-wd-backdrop ::selection {
  background: rgba(249, 115, 22, 0.35);
  color: #ffffff;
}

.rex-wd-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background:
    radial-gradient(680px 360px at 50% 10%, rgba(249, 115, 22, 0.16), transparent 70%),
    radial-gradient(560px 320px at 88% 92%, rgba(0, 82, 255, 0.15), transparent 72%),
    rgba(5, 7, 11, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow-y: auto;
  animation: rexWdBackdropIn 0.36s var(--wd-ease-out) both;
}

.rex-wd-dialog {
  width: min(636px, 100%);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(249, 115, 22, 0.45) rgba(255, 255, 255, 0.04);
  border-radius: 22px;
  border: 1px solid var(--wd-line);
  background: linear-gradient(180deg, var(--wd-surface-2) 0%, var(--wd-surface) 100%);
  box-shadow: 0 28px 72px -18px rgba(0, 0, 0, 0.82);
  padding: 20px 22px 20px;
  color: var(--wd-ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: grid;
  gap: 13px;
  animation: rexWdDialogIn 0.52s var(--wd-ease-out) both;
}

.rex-wd-dialog::-webkit-scrollbar {
  width: 6px;
}

.rex-wd-dialog::-webkit-scrollbar-thumb {
  background: rgba(249, 115, 22, 0.45);
  border-radius: 999px;
}

.rex-wd-reveal {
  animation: rexWdItemIn 0.46s var(--wd-ease-out) both;
}
.rex-wd-d1 { animation-delay: 0.03s; }
.rex-wd-d2 { animation-delay: 0.08s; }
.rex-wd-d3 { animation-delay: 0.13s; }
.rex-wd-d4 { animation-delay: 0.18s; }
.rex-wd-d5 { animation-delay: 0.23s; }
.rex-wd-d6 { animation-delay: 0.28s; }

.rex-wd-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.rex-wd-brand-id {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--wd-ink);
}

.rex-wd-brand-id img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: block;
}

.rex-wd-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(249, 115, 22, 0.42);
  background: rgba(249, 115, 22, 0.12);
  color: #fdba74;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.rex-wd-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wd-orange);
  flex: none;
}

/* Migration illustration stage */
.rex-wd-scene {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(300px 100px at 84% 50%, rgba(249, 115, 22, 0.12), transparent 72%),
    radial-gradient(240px 90px at 16% 50%, rgba(0, 82, 255, 0.1), transparent 72%),
    rgba(5, 7, 11, 0.65);
  padding: 6px 10px;
  overflow: hidden;
}

.rex-wd-scene-svg {
  width: 100%;
  height: auto;
  max-height: 102px;
  display: block;
}

.rex-wd-horizon {
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 1;
}

.rex-wd-rail-base {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1.4;
}

.rex-wd-rail-flow {
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 8 14;
  animation: rexWdFlow 2.6s linear infinite;
}

.rex-wd-flow-main {
  stroke: var(--wd-orange);
  stroke-width: 2.2;
}

.rex-wd-flow-a,
.rex-wd-flow-b {
  stroke: rgba(0, 82, 255, 0.85);
  stroke-width: 1.5;
  animation-duration: 3.3s;
}

.rex-wd-node-box {
  fill: #0d1320;
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1.4;
}

.rex-wd-node-box-active {
  fill: #151110;
  stroke: var(--wd-orange);
  stroke-width: 1.8;
}

.rex-wd-rack-bar {
  fill: rgba(255, 255, 255, 0.22);
}

.rex-wd-off-led {
  fill: #959dad;
  animation: rexWdDimBlink 3.2s ease-in-out infinite;
}

.rex-wd-web-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  transform-origin: 82px 54px;
  animation: rexWdSpinSlow 26s linear infinite;
}

.rex-wd-tg-pulse {
  fill: none;
  stroke: rgba(249, 115, 22, 0.55);
  stroke-width: 1.5;
  transform-origin: 478px 54px;
  animation: rexWdBeacon 2.8s var(--wd-ease-out) infinite;
}

.rex-wd-tg-pulse-b {
  animation-delay: 1.4s;
}

.rex-wd-plane {
  fill: var(--wd-orange);
}

.rex-wd-node-label {
  fill: var(--wd-ink-3);
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
}

.rex-wd-node-label-on {
  fill: #fdba74;
}

.rex-wd-center-box {
  fill: rgba(12, 16, 24, 0.92);
  stroke: rgba(249, 115, 22, 0.45);
  stroke-width: 1;
}

.rex-wd-center-txt {
  fill: #fdba74;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.rex-wd-packet {
  animation: rexWdTransit 3.4s var(--wd-ease-out) infinite;
}

.rex-wd-packet-2 {
  animation-name: rexWdTransitDot;
  animation-duration: 3.4s;
  animation-delay: 1.7s;
}

.rex-wd-packet-pill {
  fill: #1b130e;
  stroke: var(--wd-orange);
  stroke-width: 1.3;
}

.rex-wd-packet-icon {
  fill: none;
  stroke: var(--wd-orange-2);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rex-wd-packet-txt {
  fill: #fff7ed;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.rex-wd-packet-dot {
  fill: var(--wd-blue-soft);
}

.rex-wd-head {
  display: grid;
  gap: 6px;
}

.rex-wd-title {
  margin: 0;
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(22px, 3.4vw, 27px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--wd-ink);
}

.rex-wd-copy {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--wd-ink-2);
}

.rex-wd-timer-box {
  border-radius: 16px;
  border: 1px solid var(--wd-line);
  background: rgba(5, 7, 11, 0.56);
  padding: 13px 14px;
  display: grid;
  gap: 10px;
}

.rex-wd-timer-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--wd-ink-2);
}

.rex-wd-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.rex-wd-cell {
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--wd-tile);
  padding: 10px 6px;
  text-align: center;
  display: grid;
  gap: 3px;
}

.rex-wd-num {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(21px, 4.5vw, 28px);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--wd-ink);
  display: inline-block;
}

.rex-wd-num.is-tick {
  animation: rexWdDigitTick 0.28s var(--wd-ease-out);
}

.rex-wd-unit {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wd-ink-3);
}

.rex-wd-meter-wrap {
  width: 100%;
  height: 6px;
  display: block;
}

.rex-wd-meter-svg {
  width: 100%;
  height: 6px;
  display: block;
}

.rex-wd-meter-track {
  fill: rgba(255, 255, 255, 0.08);
}

.rex-wd-meter-fill {
  fill: var(--wd-orange);
  transition: width 0.5s var(--wd-ease-out);
}

.rex-wd-window {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  line-height: 1.35;
  color: var(--wd-ink-3);
}

.rex-wd-split {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 10px;
  align-items: stretch;
}

.rex-wd-panel {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 13px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.rex-wd-panel-title {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--wd-ink);
}

.rex-wd-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.rex-wd-steps li {
  position: relative;
  padding-left: 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--wd-ink-2);
}

.rex-wd-steps li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--wd-orange);
}

.rex-wd-steps li.rex-wd-infra-warn {
  color: #fed7aa;
  font-weight: 500;
}

.rex-wd-steps code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--wd-ink);
}

.rex-wd-panel-token {
  border-color: rgba(0, 82, 255, 0.42);
  background: linear-gradient(180deg, rgba(0, 82, 255, 0.14) 0%, rgba(0, 82, 255, 0.06) 100%);
}

.rex-wd-token-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--wd-blue);
  color: #ffffff;
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.rex-wd-token-copy {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #dbeafe;
}

.rex-wd-cta {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, var(--wd-orange-2), var(--wd-orange));
  color: #120700;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.72), 0 1px 0 rgba(255, 255, 255, 0.22) inset;
  transition: filter 0.18s ease, box-shadow 0.18s ease;
}

.rex-wd-cta-content {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: transform 0.2s var(--wd-ease-out);
}

.rex-wd-cta-arrow {
  display: inline-block;
  font-weight: 700;
  transition: transform 0.2s var(--wd-ease-out);
}

.rex-wd-cta-sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.34) 48%, transparent 72%);
  transform: translateX(-115%);
  transition: transform 0.65s var(--wd-ease-out);
}

.rex-wd-cta:hover {
  filter: brightness(1.06);
  box-shadow: 0 16px 34px -8px rgba(0, 0, 0, 0.85), 0 1px 0 rgba(255, 255, 255, 0.28) inset;
}

.rex-wd-cta:hover .rex-wd-cta-sheen,
.rex-wd-cta:focus-visible .rex-wd-cta-sheen {
  transform: translateX(115%);
}

.rex-wd-cta:hover .rex-wd-cta-content {
  transform: translateY(-1px);
}

.rex-wd-cta:hover .rex-wd-cta-arrow {
  transform: translateX(3px);
}

.rex-wd-cta:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

.rex-wd-cta:active .rex-wd-cta-content {
  transform: scale(0.985);
}

.rex-wd-tg-icon {
  width: 18px;
  height: 18px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21.5 3.2 2.9 10.4c-1.3.5-1.2 1.3-.2 1.6l4.8 1.5 1.8 5.6c.2.7.4.9.9.9.4 0 .6-.2.9-.5l2.3-2.2 4.7 3.5c.9.5 1.5.2 1.7-.8l3.1-14.6c.3-1.3-.5-1.9-1.4-1.2zM9.3 13.4l8.6-5.4c.4-.3.8-.1.5.2l-7.1 6.4-.3 3.1z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21.5 3.2 2.9 10.4c-1.3.5-1.2 1.3-.2 1.6l4.8 1.5 1.8 5.6c.2.7.4.9.9.9.4 0 .6-.2.9-.5l2.3-2.2 4.7 3.5c.9.5 1.5.2 1.7-.8l3.1-14.6c.3-1.3-.5-1.9-1.4-1.2zM9.3 13.4l8.6-5.4c.4-.3.8-.1.5.2l-7.1 6.4-.3 3.1z'/%3E%3C/svg%3E") center / contain no-repeat;
}

@keyframes rexWdBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rexWdDialogIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.965);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes rexWdItemIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rexWdFlow {
  from { stroke-dashoffset: 44; }
  to { stroke-dashoffset: 0; }
}

@keyframes rexWdTransit {
  0% {
    opacity: 0;
    transform: translateX(132px);
  }
  16% {
    opacity: 1;
  }
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(374px);
  }
}

@keyframes rexWdTransitDot {
  0% {
    opacity: 0;
    transform: translateX(148px);
  }
  16% {
    opacity: 1;
  }
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(410px);
  }
}

@keyframes rexWdBeacon {
  0% {
    opacity: 0.72;
    transform: scale(0.84);
  }
  100% {
    opacity: 0;
    transform: scale(1.26);
  }
}

@keyframes rexWdDimBlink {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.78; }
}

@keyframes rexWdSpinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes rexWdDigitTick {
  0% { transform: translateY(-4px); opacity: 0.65; }
  100% { transform: translateY(0); opacity: 1; }
}

@media (max-width: 660px) {
  .rex-wd-backdrop {
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }
  .rex-wd-dialog {
    max-height: calc(100dvh - 20px);
    padding: 14px 14px 15px;
    border-radius: 18px;
    gap: 9px;
  }
  .rex-wd-brand-id {
    font-size: 16px;
  }
  .rex-wd-brand-id img {
    width: 26px;
    height: 26px;
  }
  .rex-wd-pill {
    padding: 4px 10px;
    font-size: 11px;
  }
  .rex-wd-scene {
    padding: 3px 6px;
  }
  .rex-wd-scene-svg {
    max-height: 60px;
  }
  .rex-wd-title {
    font-size: 20px;
  }
  .rex-wd-copy {
    font-size: 13px;
    line-height: 1.42;
  }
  .rex-wd-timer-box {
    padding: 10px 11px;
    gap: 7px;
  }
  .rex-wd-timer-label {
    font-size: 12px;
  }
  .rex-wd-grid {
    gap: 6px;
  }
  .rex-wd-cell {
    padding: 7px 3px;
    gap: 2px;
  }
  .rex-wd-num {
    font-size: 20px;
  }
  .rex-wd-unit {
    font-size: 10px;
  }
  .rex-wd-window {
    font-size: 11px;
    gap: 4px;
  }
  .rex-wd-split {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .rex-wd-panel {
    padding: 9px 11px;
    gap: 5px;
  }
  .rex-wd-panel-title {
    font-size: 13px;
  }
  .rex-wd-steps {
    gap: 4px;
  }
  .rex-wd-steps li,
  .rex-wd-token-copy {
    font-size: 12.5px;
    line-height: 1.38;
  }
  .rex-wd-steps li::before {
    top: 6px;
  }
  .rex-wd-cta {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 14.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rex-wd-backdrop,
  .rex-wd-dialog,
  .rex-wd-reveal,
  .rex-wd-rail-flow,
  .rex-wd-off-led,
  .rex-wd-web-ring,
  .rex-wd-tg-pulse,
  .rex-wd-packet,
  .rex-wd-packet-2,
  .rex-wd-num.is-tick {
    animation: none;
  }
  .rex-wd-packet {
    opacity: 1;
    transform: translateX(252px);
  }
  .rex-wd-packet-2 {
    opacity: 0;
  }
  .rex-wd-cta,
  .rex-wd-cta-content,
  .rex-wd-cta-arrow,
  .rex-wd-cta-sheen,
  .rex-wd-meter-fill {
    transition: none;
  }
}
