:root {
  color-scheme: dark;
  --bg: #060714;
  --surface: rgba(16, 22, 43, 0.92);
  --surface-strong: rgba(26, 36, 70, 0.95);
  --accent: #64d1ff;
  --accent-soft: rgba(100, 209, 255, 0.18);
  --text: #e9eff9;
  --muted: #94a0c2;
  --shadow: 0 32px 120px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: radial-gradient(circle at top, rgba(100, 209, 255, 0.15), transparent 32%),
              radial-gradient(circle at bottom right, rgba(126, 85, 255, 0.12), transparent 24%),
              var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

body {
  overflow-y: auto;
}

.page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(2rem, env(safe-area-inset-top)) max(2rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(2rem, env(safe-area-inset-left));
  width: 100%;
}

.background {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg);
  transform: translateZ(0);
}

.background::before,
.background::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.background::before {
  background: radial-gradient(circle at 25% 22%, rgba(100, 209, 255, 0.28), transparent 18%),
              radial-gradient(circle at 78% 20%, rgba(150, 85, 255, 0.16), transparent 20%),
              radial-gradient(circle at 50% 78%, rgba(70, 110, 255, 0.12), transparent 22%);
  opacity: 0.55;
  transform: translate3d(0, 0, 0);
}

.background::after {
  background-image: radial-gradient(circle, rgba(255,255,255,0.75) 1px, transparent 1px);
  background-size: 140px 140px;
  mix-blend-mode: screen;
  opacity: 0.14;
}

.nebula {
  position: absolute;
  inset: -10% 0 20% 0;
  background: radial-gradient(circle at 22% 8%, rgba(69, 111, 255, 0.24), transparent 22%),
              radial-gradient(circle at 76% 20%, rgba(112, 235, 255, 0.18), transparent 20%),
              radial-gradient(circle at 52% 88%, rgba(83, 91, 255, 0.12), transparent 26%);
  opacity: 0.45;
  transform: translate3d(0, 0, 0);
}

.grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 140px 140px;
  opacity: 0.14;
  transform: translate3d(0, 0, 0);
}


.orbit {
  position: absolute;
  border: 1px solid rgba(100, 209, 255, 0.14);
  border-radius: 999px;
  opacity: 0.6;
  animation: spin 24s linear infinite;
}

.orbit1 { width: 380px; height: 380px; top: 18%; left: 8%; }
.orbit2 { width: 480px; height: 480px; top: 40%; right: 4%; animation-duration: 32s; }
.orbit3 { width: 260px; height: 260px; bottom: 8%; left: 30%; animation-duration: 18s; }

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

.standby-card {
  position: relative;
  width: min(920px, 100%);
  max-width: 960px;
  padding: 3rem;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  z-index: 1;
}

.badge {
  display: inline-flex;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  background: rgba(100, 209, 255, 0.12);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.status-top > * {
  min-width: 0;
}

.refresh-button {
  flex: 0 0 auto;
}

.page-tag {
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.refresh-button {
  appearance: none;
  border: none;
  background: linear-gradient(135deg, rgba(100, 209, 255, 0.18), rgba(64, 157, 255, 0.22));
  color: var(--text);
  padding: 0.9rem 1.3rem;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.refresh-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(38, 121, 255, 0.16);
}

.refresh-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-weight: 700;
}

.status-pill.status-online {
  background: rgba(140, 255, 151, 0.16);
  color: #b6ffdb;
}

.status-pill.status-offline {
  background: rgba(255, 122, 122, 0.16);
  color: #ffbaba;
}

.status-pill.status-pending {
  background: rgba(148, 160, 194, 0.14);
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 4vw, 4rem);
  line-height: 0.98;
}

p {
  margin: 1.25rem 0 2rem;
  max-width: 780px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.85;
}

.status-panel {
  display: grid;
  gap: 1rem;
  margin-bottom: 2.2rem;
}

.status-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px;
  font-size: 0.98rem;
}

.status-line span {
  color: var(--muted);
}

.status-line strong {
  color: var(--text);
}

.scene {
  position: relative;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.75rem;
}

.server {
  position: relative;
  width: 220px;
  height: 220px;
  display: grid;
  gap: 14px;
  padding: 16px;
  background: rgba(10, 18, 38, 0.75);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 34px;
  box-shadow: inset 0 0 0 1px rgba(100, 209, 255, 0.08), 0 40px 80px rgba(0, 0, 0, 0.25);
}

.rack {
  height: 34px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(83, 91, 255, 0.18), rgba(100, 209, 255, 0.1));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
  position: relative;
  overflow: hidden;
}

.rack::before {
  content: '';
  position: absolute;
  inset: 10% 12%;
  background: linear-gradient(90deg, rgba(255,255,255,0.12), transparent 40%, rgba(255,255,255,0.12));
  opacity: 0.55;
}

.server::after {
  content: '';
  position: absolute;
  inset: 50% 20%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(100,229,255,0.48), transparent 60%);
  opacity: 0.6;
  animation: pulseGlow 3s ease-in-out infinite;
}


.pulse {
  position: absolute;
  border-radius: 50%;
  background: rgba(100, 209, 255, 0.14);
  box-shadow: 0 0 60px rgba(100, 209, 255, 0.4);
  animation: spread 4.6s ease-out infinite;
}

.pulse1 { width: 90px; height: 90px; top: 40%; left: 24%; animation-delay: 0s; }
.pulse2 { width: 120px; height: 120px; bottom: 24%; right: 22%; animation-delay: 1.2s; }

@keyframes spread {
  0% { transform: scale(0.28); opacity: 0.45; }
  70% { opacity: 0.14; }
  100% { transform: scale(1.9); opacity: 0; }
}

@keyframes pulseGlow {
  0%, 100% { transform: translateY(-1px) scale(1); opacity: 0.55; }
  50% { transform: translateY(2px) scale(1.06); opacity: 0.8; }
}

.hint {
  color: var(--muted);
  text-align: center;
  font-size: 0.95rem;
}

.connection-card {
  margin-top: 1.5rem;
  padding: 1.2rem 1.4rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.connection-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.connection-card {
  margin-top: 1.5rem;
  padding: 1.3rem 1.4rem 1.4rem;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(20, 30, 62, 0.92), rgba(15, 20, 45, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.18);
}

.connection-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  min-height: 64px;
  flex-wrap: wrap;
}

.connection-status > * {
  min-width: 0;
}

.endpoint {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(100, 209, 255, 0.14);
}

.endpoint .icon {
  width: 48px;
  height: 48px;
  display: block;
}

.endpoint-cloud {
  background: linear-gradient(180deg, rgba(8,16,30,0.18), rgba(6,10,20,0.22));
  border-radius: 50%;
}

.endpoint-cloud .icon-cloud path { fill: url(#g-cloud); }

.endpoint-server {
  background: linear-gradient(180deg, rgba(10,18,38,0.6), rgba(8,12,24,0.7));
  border-radius: 10px;
}

.icon-server .leds circle {
  opacity: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.45));
  transform: none;
  /* animation removed: static LEDs */
}

.connector {
  position: relative;
  width: min(400px, calc(100% - 140px));
  max-width: 400px;
  min-width: 0;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.connector-line {
  position: absolute;
  inset: 50% 0 auto 0;
  transform: translateY(-50%);
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(100, 209, 255, 0.16);
}

.traffic-flow {
  position: absolute;
  inset: 50% 0 auto 0;
  transform: translateY(-50%);
  width: calc(100% - 16px);
  height: 8px;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 24%,
    rgba(140,255,151,0.95) 24%,
    rgba(140,255,151,0.95) 34%,
    transparent 34%,
    transparent 48%
  );
  background-size: 100px 100%;
  opacity: 0;
}

.connector-cross {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.connector-cross::before,
.connector-cross::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 22px;
  background: rgba(255, 122, 122, 0.95);
  border-radius: 999px;
}

.connector-cross::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.connector-cross::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.connection-label {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.connection-active .connector-line {
  background: rgba(140, 255, 151, 0.28);
}

.connection-active .traffic-flow {
  opacity: 1;
  animation: trafficMove 1.25s linear infinite;
}

.connection-active .endpoint,
.connection-active .endpoint-cloud,
.connection-active .endpoint-server {
  border-color: rgba(140, 255, 151, 0.4);
}

.connection-failed .connector-line {
  background: rgba(255, 122, 122, 0.28);
}

.connection-failed .connector-cross {
  opacity: 1;
}

.connection-failed .endpoint,
.connection-failed .endpoint-cloud,
.connection-failed .endpoint-server {
  border-color: rgba(255, 122, 122, 0.55);
}

@keyframes trafficMove {
  0% { background-position: 0 0; }
  100% { background-position: -100px 0; }
}

@media (max-width: 720px) {
  html, body {
    min-height: 100%;
  }

  .page {
    align-items: flex-start;
    justify-content: flex-start;
    padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  }

  .standby-card {
    width: 100%;
    min-height: calc(100dvh - 1.5rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.25rem;
    border-radius: 22px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
  }

  .badge {
    max-width: 100%;
    margin-bottom: 0.85rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.72rem;
    line-height: 1.35;
    white-space: normal;
  }

  h1 {
    font-size: 2.45rem;
    line-height: 1;
  }

  .page-tag {
    font-size: 0.78rem;
    line-height: 1.4;
  }

  .status-top {
    align-items: stretch;
    gap: 0.75rem;
    margin-top: 1.1rem;
  }

  .refresh-button {
    width: 100%;
    justify-self: stretch;
    padding: 0.85rem 1rem;
  }

  .status-panel {
    gap: 0.75rem;
    margin-bottom: 1.2rem;
  }

  .status-line {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
    align-items: start;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
  }

  .status-line span {
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .status-line strong {
    overflow-wrap: anywhere;
  }

  .status-pill {
    width: fit-content;
    max-width: 100%;
    min-height: 36px;
    padding: 0.55rem 0.75rem;
  }

  .hint {
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .connection-card {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 18px;
  }

  .connection-status {
    display: grid;
    grid-template-columns: 54px minmax(96px, 1fr) 54px;
    align-items: center;
    justify-content: stretch;
    gap: 0.6rem;
    min-height: 54px;
    margin-bottom: 0.8rem;
    flex-wrap: nowrap;
  }

  .endpoint {
    width: 54px;
    height: 54px;
    border-radius: 14px;
  }

  .endpoint-cloud {
    border-radius: 50%;
  }

  .endpoint-server {
    border-radius: 10px;
  }

  .endpoint .icon {
    width: 40px;
    height: 40px;
  }

  .connector {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .connection-label {
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .orbit {
    display: none;
  }
}

@media (max-width: 380px) {
  .standby-card {
    min-height: calc(100dvh - 1rem);
    padding: 1rem;
  }

  h1 {
    font-size: 2.05rem;
  }

  .connection-status {
    grid-template-columns: 48px minmax(72px, 1fr) 48px;
    gap: 0.5rem;
  }

  .endpoint {
    width: 48px;
    height: 48px;
  }

  .endpoint .icon {
    width: 36px;
    height: 36px;
  }

  .connector-line,
  .traffic-flow {
    height: 6px;
  }
}
