:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #5b6876;
  --line: #cbd5df;
  --accent: #246b5f;
  --accent-dark: #1b5148;
  --error: #b42318;
  --success: #1f7a4d;
  --track: #d9e3ea;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(36, 107, 95, 0.10), transparent 32%),
    linear-gradient(135deg, #f4f6f8 0%, #e9eef2 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.page {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 16px 40px rgba(23, 32, 42, 0.08);
}

.heading {
  margin-bottom: 24px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.2;
}

.upload-form {
  display: grid;
  gap: 20px;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 28px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: #f9fbfc;
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #eef7f4;
  transform: scale(1.01);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.drop-title {
  display: block;
  width: 100%;
  font-size: 22px;
  font-weight: 700;
}

.drop-subtitle {
  display: block;
  width: 100%;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--accent);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.button:hover {
  background: var(--accent-dark);
}

.button-secondary {
  background: #dce4ea;
  color: var(--text);
}

.button-secondary:hover {
  background: #cbd5df;
}

.status {
  min-height: 24px;
  font-weight: 700;
}

.status.error,
.progress-message.error {
  color: var(--error);
}

.progress-message.success {
  color: var(--success);
}

.progress-message.pending {
  color: var(--muted);
}

.progress-panel {
  display: grid;
  gap: 22px;
}

.transfer-scene {
  position: relative;
  min-height: 120px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(36, 107, 95, 0.08), rgba(36, 107, 95, 0.02)),
    repeating-linear-gradient(90deg, transparent 0, transparent 34px, rgba(23, 32, 42, 0.04) 35px);
}

.transfer-track {
  position: absolute;
  inset: 24px 130px 24px 24px;
  border-top: 2px solid var(--track);
  border-bottom: 2px solid var(--track);
}

.packet {
  position: absolute;
  top: 50%;
  width: 42px;
  height: 30px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(23, 32, 42, 0.14);
  animation: travel 2.4s ease-in-out infinite;
}

.packet::before {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 8px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 6px 0 rgba(36, 107, 95, 0.35);
}

.packet-a {
  animation-delay: 0ms;
}

.packet-b {
  animation-delay: 420ms;
}

.packet-c {
  animation-delay: 840ms;
}

.server-lines {
  position: absolute;
  top: 26px;
  right: 28px;
  width: 76px;
  height: 70px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(23, 32, 42, 0.14);
}

.server-lines span {
  display: block;
  width: 46px;
  height: 5px;
  margin: 12px auto 0;
  border-radius: 999px;
  background: var(--track);
  animation: serverPulse 1.5s ease-in-out infinite;
}

.server-lines span:nth-child(2) {
  animation-delay: 180ms;
}

.server-lines span:nth-child(3) {
  animation-delay: 360ms;
}

@keyframes travel {
  0% {
    left: 0;
    opacity: 0;
    transform: translateY(-50%) scale(0.92);
  }

  15% {
    opacity: 1;
  }

  70% {
    opacity: 1;
  }

  100% {
    left: calc(100% - 42px);
    opacity: 0;
    transform: translateY(-50%) scale(1);
  }
}

@keyframes serverPulse {
  0%,
  100% {
    background: var(--track);
  }

  50% {
    background: var(--accent);
  }
}

.progress-wrap {
  display: grid;
  gap: 10px;
}

.progress-bar {
  height: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef2f5;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #246b5f, #43a186);
  transition: width 180ms ease;
}

.progress-percent {
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.progress-message {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.progress-files {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.progress-files li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-wrap: anywhere;
}

.file-size {
  color: var(--muted);
  white-space: nowrap;
}

.progress-panel.is-complete .transfer-scene,
.progress-panel.has-error .transfer-scene {
  animation-play-state: paused;
}

.is-hidden {
  display: none !important;
}

.result-page {
  max-width: 720px;
}

.result-panel {
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
}

.result-panel h1 {
  font-size: 34px;
}

.result-message {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.result-mark {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 50%;
}

.result-success .result-mark {
  background: rgba(31, 122, 77, 0.12);
  border: 2px solid rgba(31, 122, 77, 0.35);
}

.result-success .result-mark::after {
  content: "";
  position: absolute;
  left: 27px;
  top: 20px;
  width: 24px;
  height: 38px;
  border-right: 7px solid var(--success);
  border-bottom: 7px solid var(--success);
  transform: rotate(42deg);
}

.result-error .result-mark {
  background: rgba(180, 35, 24, 0.10);
  border: 2px solid rgba(180, 35, 24, 0.30);
}

.result-error .result-mark::before,
.result-error .result-mark::after {
  content: "";
  position: absolute;
  left: 38px;
  top: 22px;
  width: 7px;
  height: 40px;
  border-radius: 999px;
  background: var(--error);
}

.result-error .result-mark::before {
  transform: rotate(45deg);
}

.result-error .result-mark::after {
  transform: rotate(-45deg);
}

@media (max-width: 640px) {
  .page {
    width: min(100% - 20px, 920px);
    padding: 20px 0;
  }

  .panel {
    padding: 20px;
  }

  h1 {
    font-size: 24px;
  }

  .transfer-track {
    inset: 24px 96px 24px 18px;
  }

  .server-lines {
    right: 18px;
    width: 58px;
  }

  .server-lines span {
    width: 34px;
  }

  .progress-files li {
    grid-template-columns: 1fr;
  }
}
