/* diavlo transfer — minimalist, premium, Apple-ish. Frosted glass on a slow aurora. */
:root {
  --bg: #060609;
  --ink: #f3f3f7;
  --muted: #9396a3;
  --faint: #6c6f7d;
  --card: rgba(22, 23, 30, 0.58);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-strong: rgba(255, 255, 255, 0.16);
  --accent: #6e8bff;
  --accent2: #b06eff;
  --accent3: #46e0c8;
  --ok: #51e0a3;
  --err: #ff6b6b;
  --warn: #ffd479;
  --radius: 24px;
  --grad: linear-gradient(135deg, var(--accent), var(--accent2));
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------- aurora + texture ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  filter: blur(70px) saturate(150%);
}
.blob {
  position: absolute;
  width: 44vmax;
  height: 44vmax;
  border-radius: 50%;
  opacity: 0.42;
  mix-blend-mode: screen;
  animation: drift 32s ease-in-out infinite;
  will-change: transform;
}
.b1 { background: #3a52ff; top: -16%; left: -12%; animation-delay: 0s; }
.b2 { background: #9b3bff; bottom: -20%; right: -14%; animation-delay: -11s; }
.b3 { background: #1f7bff; top: 28%; left: 38%; width: 30vmax; height: 30vmax; animation-delay: -19s; }
.b4 { background: #1ec8a8; bottom: 6%; left: 4%; width: 24vmax; height: 24vmax; opacity: 0.28; animation-delay: -7s; }
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(5vw, 4vh) scale(1.12); }
  66% { transform: translate(-4vw, -3vh) scale(0.9); }
}
/* radial vignette for depth */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% -10%, transparent 40%, rgba(0,0,0,0.55) 100%);
}
/* film grain */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
}

/* ---------- layout ---------- */
#app {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 36px 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 22px rgba(110, 139, 255, 0.42), inset 0 1px 0 rgba(255,255,255,0.3);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-text span { color: var(--muted); font-weight: 500; }

.card {
  position: relative;
  width: min(540px, 100%);
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(40px) saturate(165%);
  -webkit-backdrop-filter: blur(40px) saturate(165%);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 30px;
}
/* subtle top sheen */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, rgba(255,255,255,0.18), transparent 38%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.hidden { display: none !important; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.caps { text-transform: uppercase; letter-spacing: 0.12em; font-size: 11px; }

/* ---------- dropzone ---------- */
.dropzone {
  position: relative;
  border: 1.5px dashed rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.25s, box-shadow 0.25s;
}
.dropzone:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.025);
}
.dropzone.drag {
  border-color: transparent;
  background: rgba(110, 139, 255, 0.1);
  transform: scale(1.012);
  box-shadow: 0 0 0 1.5px var(--accent), 0 18px 50px rgba(110, 139, 255, 0.28);
}
.dz-icon {
  width: 60px; height: 60px; margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 12px 34px rgba(110, 139, 255, 0.45), inset 0 1px 0 rgba(255,255,255,0.35);
  animation: float 3.6s ease-in-out infinite;
}
.dz-icon svg { width: 26px; height: 26px; }
.dropzone:hover .dz-icon { animation-play-state: paused; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.dz-title { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; }
.dz-sub { margin-top: 7px; color: var(--muted); font-size: 14px; }

/* ---------- facts ---------- */
.facts {
  list-style: none;
  margin: 20px 2px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  line-height: 1.5;
}
.facts li { padding-left: 20px; position: relative; }
.facts li::before {
  content: '';
  position: absolute; left: 4px; top: 7px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--grad);
}

/* ---------- panels / file info ---------- */
.panel { display: flex; flex-direction: column; gap: 17px; }
.file-row { display: flex; align-items: center; gap: 14px; }
.file-ic {
  flex: none;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
  color: var(--accent);
}
.file-ic svg { width: 22px; height: 22px; }
.fname { font-size: 17px; font-weight: 600; word-break: break-word; letter-spacing: -0.01em; }
.fsize { margin-top: 2px; font-size: 14px; }
.hint { margin: 2px 0 0; font-size: 13px; line-height: 1.55; }

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  border: none;
  border-radius: 15px;
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  background: var(--grad);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.25s, filter 0.2s, opacity 0.2s;
  box-shadow: 0 12px 32px rgba(110, 139, 255, 0.36), inset 0 1px 0 rgba(255,255,255,0.25);
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn:hover { transform: translateY(-1.5px); filter: brightness(1.05); box-shadow: 0 16px 40px rgba(110, 139, 255, 0.45); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: default; transform: none; filter: none; }
.btn.small { padding: 11px 16px; font-size: 14px; box-shadow: none; border-radius: 12px; }
.btn.ghost { background: rgba(255, 255, 255, 0.08); box-shadow: none; }
.btn-ghost {
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border-radius: 11px;
  padding: 8px 13px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--stroke-strong); }

/* ---------- link box ---------- */
.link-row { display: flex; gap: 8px; }
#link {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--stroke);
  border-radius: 13px;
  color: var(--ink);
  padding: 13px 14px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  transition: border-color 0.2s;
}
#link:focus { outline: none; border-color: var(--accent); }
.warn {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--warn);
  background: rgba(255, 184, 0, 0.07);
  border: 1px solid rgba(255, 184, 0, 0.2);
  border-radius: 13px;
  padding: 11px 14px;
}
.warn-dot {
  flex: none;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 0 rgba(255, 212, 121, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 212, 121, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(255, 212, 121, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 212, 121, 0); }
}

/* ---------- peers ---------- */
#peers { display: flex; flex-direction: column; gap: 14px; }
.peer {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.022);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.peer[data-state="done"] { border-color: rgba(81, 224, 163, 0.35); box-shadow: 0 0 26px rgba(81, 224, 163, 0.12); }
.peer[data-state="error"] { border-color: rgba(255, 107, 107, 0.32); }
.peer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; }
.peer-id { font-family: ui-monospace, monospace; font-size: 12px; color: var(--faint); letter-spacing: 0.02em; }
.peer-status { font-size: 12.5px; color: var(--muted); }
.peer[data-state="done"] .peer-status { color: var(--ok); }
.peer[data-state="error"] .peer-status { color: var(--err); }
.peer-meta { display: flex; gap: 9px; font-size: 12px; color: var(--faint); margin-top: 9px; font-variant-numeric: tabular-nums; }
.peer-ctrl { display: flex; gap: 8px; margin-top: 13px; }

/* ---------- progress bars ---------- */
.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  box-shadow: 0 0 16px rgba(140, 130, 255, 0.55);
  position: relative;
  overflow: hidden;
}
.bar-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.8s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---------- receiver: progress ring ---------- */
.recv-wait { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 22px 0; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.12);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ring-wrap {
  position: relative;
  width: 188px; height: 188px;
  margin: 6px auto 4px;
}
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 8; }
.ring-prog {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  filter: drop-shadow(0 0 8px rgba(110, 139, 255, 0.7));
  transition: stroke-dashoffset 0.45s ease, stroke 0.4s;
}
.ring-center {
  position: absolute; inset: 0;
  display: grid; place-items: center;
}
#rPct {
  font-size: 42px; font-weight: 600; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.check {
  display: none;
  width: 56px; height: 56px;
}
.check path {
  fill: none;
  stroke: var(--ok);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
}
#recvProgress.done .ring-prog { stroke: var(--ok); filter: drop-shadow(0 0 10px rgba(81, 224, 163, 0.7)); }
#recvProgress.done #rPct { display: none; }
#recvProgress.done .check { display: block; animation: draw 0.55s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.recv-meta { display: flex; justify-content: center; gap: 14px; margin-top: 14px; font-size: 13px; font-variant-numeric: tabular-nums; }
.status { text-align: center; margin-top: 14px; font-size: 14px; color: var(--muted); }
.status.err { color: var(--err); line-height: 1.5; }
.status .ok, .ok { color: var(--ok); }

/* ---------- misc ---------- */
.foot { letter-spacing: 0.02em; opacity: 0.7; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; }
.foot-nav a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.foot-nav a:hover { color: var(--ink); }
.foot-tag { opacity: 0.8; }
.msg { font-size: 16px; line-height: 1.55; margin-bottom: 18px; }

@media (max-width: 480px) {
  .card { padding: 24px; }
  #rPct { font-size: 36px; }
  .ring-wrap { width: 164px; height: 164px; }
  .dropzone { padding: 44px 18px; }
}
