* {
  box-sizing: border-box;
}

:root {
  --bg-1: #0b1020;
  --bg-2: #131c31;
  --card: rgba(15, 23, 42, 0.92);
  --line: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-2: #2563eb;
  --success-bg: rgba(59, 130, 246, 0.10);
  --success-line: rgba(59, 130, 246, 0.35);
  --error-bg: rgba(239, 68, 68, 0.12);
  --error-line: rgba(239, 68, 68, 0.35);
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(170, 20, 35, 0.24), transparent 24%),
    radial-gradient(circle at 80% 16%, rgba(130, 10, 20, 0.22), transparent 22%),
    radial-gradient(circle at 55% 78%, rgba(95, 8, 16, 0.18), transparent 26%),
    linear-gradient(135deg, #120304, #1a0508 35%, #0d0204 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -10%;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    radial-gradient(circle at 22% 32%, rgba(255, 90, 90, 0.08), transparent 18%),
    radial-gradient(circle at 68% 28%, rgba(255, 70, 70, 0.07), transparent 20%),
    radial-gradient(circle at 48% 68%, rgba(180, 20, 30, 0.09), transparent 22%),
    radial-gradient(circle at 34% 82%, rgba(130, 10, 20, 0.08), transparent 18%);
  filter: blur(54px);
  opacity: 0.95;
  animation: fogShift 18s ease-in-out infinite alternate;
}

body::after {
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02), transparent 20%),
    radial-gradient(circle at center, transparent 42%, rgba(0, 0, 0, 0.44) 100%);
  filter: blur(12px);
  opacity: 1;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.82) 70%, transparent 100%);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.82) 70%, transparent 100%);
}

@keyframes fogShift {
  0% {
    transform: translate3d(-1.5%, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(2%, -1%, 0) scale(1.05);
  }
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 760px;
  padding: 32px;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-bottom: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.25);
  color: #bfdbfe;
  font-size: 0.85rem;
  word-break: break-word;
}

#job-id-label {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0 0 8px;
  font-size: 2.2rem;
  line-height: 1.15;
}

.subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.5;
}

.form {
  display: grid;
  gap: 16px;
}

label {
  font-size: 0.95rem;
  color: #dbeafe;
}

input[type="url"] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #334155;
  background: #091121;
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input[type="url"]::placeholder {
  color: #64748b;
}

input[type="url"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
}

.destination-group {
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.destination-group legend {
  margin-bottom: 8px;
  color: #dbeafe;
  font-weight: 600;
}

.destination-help {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.95rem;
}

.destination-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 6px;
  border-radius: 22px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.78);
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 20px rgba(0, 0, 0, 0.12);
}

.destination-switch input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-option {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 96px;
  min-width: 0;
  padding: 18px;
  cursor: pointer;
  background: transparent;
  color: #cbd5e1;
  border-radius: 16px;
  transition:
    background 180ms ease,
    color 180ms ease,
    transform 160ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    filter 180ms ease;
}

.switch-left {
  border-right: 1px solid rgba(148, 163, 184, 0.15);
}

.switch-title {
  font-weight: 700;
  font-size: 1rem;
  color: #eff6ff;
  letter-spacing: 0.01em;
}

.switch-text {
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

@media (hover: hover) {
  .switch-option:hover {
    background: rgba(96, 165, 250, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
  }

  button:hover,
  .back-link:hover {
    filter: brightness(1.05);
  }

  button:hover {
    transform: translateY(-2px);
    box-shadow:
      0 16px 30px rgba(37, 99, 235, 0.34),
      inset 0 1px 0 rgba(255, 255, 255, 0.22);
  }

  .back-link:hover {
    color: #bfdbfe;
  }
}

.switch-option:active {
  transform: translateY(0) scale(0.995);
  filter: brightness(0.98);
}

#destination-server:checked + .switch-option,
#destination-device:checked + .switch-option {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.24), rgba(37, 99, 235, 0.34));
  box-shadow:
    inset 0 0 0 1px rgba(96, 165, 250, 0.28),
    0 10px 22px rgba(37, 99, 235, 0.14);
  transform: translateY(-1px);
}

#destination-server:checked + .switch-option .switch-title,
#destination-server:checked + .switch-option .switch-text,
#destination-device:checked + .switch-option .switch-title,
#destination-device:checked + .switch-option .switch-text {
  color: #eff6ff;
}

#destination-server:focus-visible + .switch-option,
#destination-device:focus-visible + .switch-option {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(96, 165, 250, 0.18),
    inset 0 0 0 1px rgba(96, 165, 250, 0.28);
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.12);
  color: #dbeafe;
  overflow-wrap: anywhere;
}

button {
  margin-top: 6px;
  padding: 15px 20px;
  border: 1px solid rgba(147, 197, 253, 0.18);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.98), rgba(37, 99, 235, 0.98));
  color: white;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 180ms ease,
    filter 180ms ease,
    border-color 180ms ease;
  box-shadow:
    0 10px 24px rgba(37, 99, 235, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

button:active {
  transform: translateY(0);
  filter: brightness(0.98);
  box-shadow:
    0 8px 18px rgba(37, 99, 235, 0.24),
    inset 0 2px 6px rgba(0, 0, 0, 0.12);
}

button:focus-visible,
.back-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.20);
  border-radius: 12px;
}

.messages {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}

.message {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--success-bg);
  border: 1px solid var(--success-line);
  color: #dbeafe;
  overflow-wrap: anywhere;
}

.progress-wrap {
  margin: 20px 0;
}

.progress-bar {
  width: 100%;
  height: 16px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #2563eb);
  transition: width 0.35s ease;
}

.progress-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #cbd5e1;
  font-size: 0.95rem;
}

.status-box,
.error-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.status-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #dbeafe;
}

.error-box {
  background: var(--error-bg);
  border: 1px solid var(--error-line);
  color: #fecaca;
}

.hidden {
  display: none !important;
}

.back-link {
  display: inline-block;
  margin-top: 18px;
  color: #93c5fd;
  text-decoration: none;
  transition: color 160ms ease, filter 160ms ease;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .page {
    padding: 16px;
  }

  .card {
    padding: 22px;
    border-radius: 18px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .destination-switch {
    grid-template-columns: 1fr;
  }

  .switch-left {
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  }

  .progress-meta {
    flex-direction: column;
    align-items: flex-start;
  }
}
