.upload-workspace {
  align-items: stretch;
}

.upload-result {
  overflow: hidden;
}

.paired-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, 0.55fr);
  gap: 12px;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-row button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 760;
}

.quick-row button:hover,
.quick-row button:focus-visible {
  border-color: var(--teal);
  background: var(--surface-soft);
}

.scenario-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.scenario-presets button {
  display: grid;
  justify-items: start;
  min-height: 48px;
  padding: 8px 10px;
}

.scenario-presets strong,
.scenario-presets span {
  display: block;
}

.scenario-presets strong {
  font-size: 13px;
}

.scenario-presets span {
  color: var(--muted);
  font-size: 12px;
}

.upload-animation {
  margin: 16px 0;
}

.upload-device {
  position: relative;
  display: grid;
  gap: 14px;
  min-height: 258px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teal) 15%, transparent), transparent 42%),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--line) 48%, transparent) 0 1px, transparent 1px 44px),
    var(--surface-soft);
  padding: 16px;
}

.device-top,
.file-card,
.animation-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-top {
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--teal) 18%, transparent);
}

.file-card {
  position: relative;
  z-index: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  padding: 14px;
  box-shadow: var(--shadow);
}

.file-card svg {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  color: var(--teal-dark);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file-card strong,
.file-card span {
  display: block;
  min-width: 0;
}

.file-card strong {
  overflow-wrap: anywhere;
}

.file-card span {
  color: var(--muted);
  font-size: 13px;
}

.progress-shell {
  position: relative;
  height: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.preview-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), color-mix(in srgb, var(--teal) 62%, var(--amber)));
  transition: width 160ms linear;
}

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

.transfer-readout span {
  display: grid;
  gap: 2px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  padding: 8px;
}

.transfer-readout strong,
.transfer-readout small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.transfer-readout strong {
  color: var(--ink);
  font-size: 13px;
}

.transfer-readout small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.upload-device.is-complete .status-dot {
  background: var(--amber);
}

.packet-lane {
  position: relative;
  height: 28px;
  overflow: hidden;
  border-radius: var(--radius);
}

.packet-lane span {
  position: absolute;
  top: 8px;
  left: -18px;
  width: 13px;
  height: 13px;
  border-radius: 4px;
  background: var(--teal);
  opacity: 0.72;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--surface) 55%, transparent);
  animation: packet-run 2.8s linear infinite;
}

.packet-lane span:nth-child(2) {
  animation-delay: 0.55s;
  top: 4px;
  background: var(--amber);
}

.packet-lane span:nth-child(3) {
  animation-delay: 1.1s;
  top: 13px;
}

.packet-lane span:nth-child(4) {
  animation-delay: 1.65s;
  top: 7px;
  background: var(--teal-dark);
}

.upload-device.is-complete .packet-lane span,
.upload-device.is-waiting .packet-lane span {
  animation-play-state: paused;
  opacity: 0;
}

.notice.warning {
  border-color: color-mix(in srgb, var(--red) 45%, var(--line));
  background: color-mix(in srgb, var(--red) 10%, var(--surface));
}

@keyframes packet-run {
  0% {
    transform: translateX(0) scale(0.85);
    opacity: 0;
  }
  12% {
    opacity: 0.72;
  }
  90% {
    opacity: 0.72;
  }
  100% {
    transform: translateX(calc(100vw + 80px)) scale(1.04);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .packet-lane span {
    animation: none;
  }

  .progress-fill {
    transition: none;
  }
}

@media (max-width: 720px) {
  .paired-input {
    grid-template-columns: 1fr;
  }

  .scenario-presets {
    grid-template-columns: 1fr;
  }

  .transfer-readout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .upload-device {
    min-height: 230px;
  }
}
