*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0d0d0d;
  --ring:     rgba(255,255,255,0.07);
  --blue:     #4a9eff;
  --blue-dim: rgba(74,158,255,0.15);
  --text:     #ffffff;
  --text2:    rgba(255,255,255,0.55);
  --text3:    rgba(255,255,255,0.3);
  --surface:  rgba(255,255,255,0.06);
  --border:   rgba(255,255,255,0.1);
  --font:     'Inter', sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── Header ── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: rgba(13,13,13,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.about-btn {
  margin-left: auto;
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--text3);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.about-btn svg { width: 20px; height: 20px; }

.about-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.brand-icon {
  width: 22px; height: 22px;
  color: var(--blue);
}

/* ── Main ── */
main {
  position: fixed;
  inset: 52px 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Radar Stage ── */
.radar-stage {
  flex: 1;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Background rings — static, faint */
.radar-bg {
  position: absolute;
  width: min(90vw, 420px);
  height: min(90vw, 420px);
  pointer-events: none;
}

.bg-ring {
  fill: none;
  stroke: var(--ring);
  stroke-width: 1;
}

/* ── Center sonar icon ── */
.center-icon {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.sonar-svg {
  width: 64px; height: 64px;
  overflow: visible;
}

/* ── Transfer focus mode — radar freezes, spotlight on the connected peer ── */
.radar-stage.transfer-active .center-icon {
  opacity: 0.25;
  transition: opacity 0.3s;
}

.peer-node {
  transition: opacity 0.3s;
}

.radar-stage.transfer-active .peer-node:not(.focused) {
  opacity: 0.12;
  pointer-events: none;
}

.radar-stage.transfer-active .peer-node.focused .peer-avatar {
  transform: scale(1.15);
  box-shadow: 0 0 0 8px rgba(74,158,255,0.25), 0 8px 28px rgba(74,158,255,0.35);
}

@keyframes sonarPing {
  0%   { r: 20; opacity: 0.6; }
  100% { r: 80; opacity: 0; }
}

/* ── Self info ── */
.self-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}

.self-label {
  font-size: 12px;
  color: var(--text3);
}

.self-name {
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.self-name:hover {
  border-color: var(--blue);
  background: rgba(74,158,255,0.1);
}

.self-name-input {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--blue);
  border-radius: 8px;
  padding: 3px 10px;
  outline: none;
  text-align: center;
  width: 140px;
}

.self-network {
  font-size: 11px;
  color: var(--blue);
  background: rgba(74,158,255,0.12);
  border: 1px solid rgba(74,158,255,0.25);
  border-radius: 6px;
  padding: 2px 8px;
}

/* ── Scan hint ── */
.scan-hint {
  position: absolute;
  bottom: 24px;
  font-size: 12px;
  color: var(--text3);
  letter-spacing: 0.03em;
  pointer-events: none;
}

.scan-hint.hidden { display: none; }

/* ── Peer Nodes ── */
.peer-nodes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.peer-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  pointer-events: all;
}

/* Animasi masuk peer — pakai inner wrapper .peer-inner */
.peer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: nodeIn 0.5s cubic-bezier(0.34,1.4,0.64,1) both;
}

@keyframes nodeIn {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

/* Device avatar — blue circle with white SVG icon */
.peer-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

/* Subtle shadow line below avatar (like AirDrop) */
.peer-avatar::after {
  content: '';
  position: absolute;
  bottom: -5px;
  width: 30px;
  height: 3px;
  background: radial-gradient(ellipse, rgba(74,158,255,0.4) 0%, transparent 70%);
  border-radius: 50%;
}

.peer-avatar svg {
  width: 30px; height: 30px;
  color: #fff;
}

/* Live RTC-connection indicator — separate element so it doesn't collide with
   the box-shadow used by .paired / .has-files on .peer-avatar itself. */
.peer-status-dot {
  position: absolute;
  bottom: -2px;
  left: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text3);
  border: 2px solid var(--bg);
  transition: background 0.2s;
}

.peer-node.connected .peer-status-dot {
  background: #35d07f;
}

.peer-node:hover .peer-avatar {
  transform: scale(1.08);
  box-shadow: 0 0 0 6px rgba(74,158,255,0.18), 0 8px 24px rgba(74,158,255,0.25);
}

/* Pin / permanent-pair toggle */
.peer-pin {
  position: absolute;
  top: -2px; right: -2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(13,13,13,0.85);
  border: 1px solid var(--border);
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.peer-pin svg { width: 10px; height: 10px; }

.peer-pin:hover {
  color: var(--blue);
  border-color: var(--blue);
}

/* Paired device — permanent trust indicator */
.peer-node.paired .peer-avatar {
  box-shadow: 0 0 0 2px #ffd24a;
}

.peer-node.paired .peer-pin {
  color: #ffd24a;
  border-color: #ffd24a;
  background: rgba(255,210,74,0.15);
}

.peer-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  text-shadow: 0 1px 6px rgba(0,0,0,0.8);
  text-align: center;
}

.peer-os {
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
  margin-top: -4px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.8);
}

/* has-files highlight */
.peer-node.has-files .peer-avatar {
  box-shadow: 0 0 0 3px rgba(74,158,255,0.5);
}

/* ── Bottom: Drop Zone ── */
.drop-zone {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drop-zone > div, .drop-zone-box {
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.drop-zone-box {
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.drop-zone-box:hover,
.drop-zone-box.drag-over {
  border-color: var(--blue);
  background: var(--blue-dim);
}

.drop-zone-box svg { color: var(--blue); flex-shrink: 0; }

.browse-link {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Pending badge */
.pending {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--blue-dim);
  border: 1px solid rgba(74,158,255,0.3);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--blue);
  animation: slideUp 0.3s cubic-bezier(0.34,1.4,0.64,1);
}

.pending[hidden] { display: none; }

@keyframes slideUp {
  from { opacity:0; transform:translateY(6px); }
  to   { opacity:1; transform:translateY(0); }
}

.pending svg { flex-shrink: 0; }

.pending span { flex: 1; }

.pending button {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  transition: color 0.2s;
}

.pending button:hover { color: #f87171; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(20,20,20,0.95);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  z-index: 60;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}

.toast.show  { opacity:1; transform:translateX(-50%) translateY(0); }
.toast.ok    { border-color:#4ade80; color:#4ade80; }
.toast.err   { border-color:#f87171; color:#f87171; }

/* ── Modal ── */
.modal-wrap {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
}

.modal-wrap[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 440px;
  background: #161616;
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 28px 24px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: modalUp 0.35s cubic-bezier(0.34,1.3,0.64,1);
}

@keyframes modalUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-icon-wrap {
  margin-bottom: 10px;
}

.modal-sonar {
  width: 64px; height: 64px;
  overflow: visible;
}

.modal-sonar.incoming .modal-sub {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text3);
  margin-top: 4px;
}

.modal-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
  margin-bottom: 10px;
}

/* File list in modal */
.file-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  margin-bottom: 6px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
}

.file-row-icon { font-size: 20px; flex-shrink: 0; }

.file-row-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row-size {
  font-size: 11px;
  color: var(--text3);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* Modal buttons */
.modal-btns {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
}

.btn-send {
  flex: 1;
  padding: 14px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
}

.btn-send:hover  { opacity: 0.88; }
.btn-send:active { transform: scale(0.97); }

.btn-cancel {
  flex: 1;
  padding: 14px;
  background: var(--surface);
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-cancel:hover { background: rgba(255,255,255,0.1); }

/* ── Progress ring ── */
.progress-ring-wrap {
  position: relative;
  width: 80px; height: 80px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}

.progress-ring-wrap svg { transform: rotate(-90deg); }

.pr-track { fill: none; stroke: rgba(74,158,255,0.12); stroke-width: 5; }
.pr-fill  {
  fill: none;
  stroke: var(--blue);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 207.3;
  stroke-dashoffset: 207.3;
  transition: stroke-dashoffset 0.25s ease;
}

.pr-pct {
  position: absolute;
  font-size: 15px;
  font-weight: 600;
  color: var(--blue);
}

/* ── Drop zone wrapper (replace div child) ── */
#drop-zone {
  width: 100%;
  max-width: 460px;
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dz-box {
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.dz-box:hover, .dz-box.drag-over {
  border-color: var(--blue);
  background: var(--blue-dim);
}

.dz-box svg { color: var(--blue); flex-shrink: 0; }

@media (max-width: 400px) {
  .peer-avatar { width: 52px; height: 52px; }
  .peer-avatar svg { width: 26px; height: 26px; }
  .peer-name { font-size: 12px; }
  .peer-os   { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .sonar-pulse, .pulse-a, .pulse-b { animation: none; }
}

/* ── About modal ── */
.about-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.about-icon svg { width: 26px; height: 26px; color: #fff; }

.about-version {
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
  background: rgba(74,158,255,0.12);
  border: 1px solid rgba(74,158,255,0.25);
  border-radius: 100px;
  padding: 2px 10px;
  margin-bottom: 4px;
}

.about-desc {
  font-size: 13px;
  color: var(--text2);
  text-align: center;
  margin-bottom: 14px;
}

.about-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 4px 0 14px;
}

.about-author-label {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.about-author-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}

.about-links {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.about-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.about-link svg { width: 16px; height: 16px; flex-shrink: 0; }

.about-link:hover { border-color: var(--blue); background: rgba(74,158,255,0.1); transform: translateY(-1px); }

.about-link.donate { border-color: rgba(250,204,21,0.35); color: #facc15; }
.about-link.donate:hover { border-color: #facc15; background: rgba(250,204,21,0.1); }

.about-copyright {
  font-size: 11px;
  color: var(--text3);
  text-align: center;
}
