:root {
  --bg-color: #0f172a;
  --panel-bg: rgba(30, 41, 59, 0.7);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-primary: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.5);
  --success: #10b981;
  --danger: #ef4444;
  --wave-color: rgba(59, 130, 246, 0.15);
  --glass-border: rgba(255, 255, 255, 0.08);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Beautiful dark mesh gradient */
  background-image:
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.1) 0px, transparent 50%);
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  z-index: 10;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  text-shadow: 0 0 20px var(--accent-glow);
}

.logo i {
  color: var(--accent-primary);
}

.status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--panel-bg);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  font-size: 0.9rem;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.status-indicator.online { color: var(--success); background-color: var(--success); }
.status-indicator.offline { color: var(--danger); background-color: var(--danger); }
.status-indicator.connecting { color: #f59e0b; background-color: #f59e0b; animation: pulse 1.5s infinite; }

/* Main Area - Radar Layout */
main {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.radar-container {
  position: relative;
  width: 600px;
  height: 600px;
  max-height: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Central Profile */
.my-profile {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.0));
  border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  color: white;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.my-avatar {
  background: linear-gradient(135deg, var(--accent-primary), #60a5fa);
  border: none;
  box-shadow: 0 0 30px var(--accent-glow);
}

.my-name-tag {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--panel-bg);
  padding: 0.5rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.my-name-tag #myName {
  font-weight: 600;
  font-size: 1rem;
}

.my-name-tag .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Radar Waves */
.wave {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid var(--wave-color);
  z-index: 0;
}

.wave1 {
  width: 250px;
  height: 250px;
  animation: ripple 4s linear infinite;
}

.wave2 {
  width: 450px;
  height: 450px;
  animation: ripple 4s linear infinite 2s;
}

@keyframes ripple {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* Peer Styles */
.peer-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.peer-node:hover {
  transform: scale(1.1);
}

.peer-node .avatar {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--glass-border);
}

.peer-node:hover .avatar {
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px var(--accent-glow);
  color: var(--accent-primary);
}

.peer-name {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--panel-bg);
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  backdrop-filter: blur(4px);
  text-align: center;
  white-space: nowrap;
}

.peer-os {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal {
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  padding: 2rem;
  border-radius: 24px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: translateY(0);
  transition: transform 0.3s ease;
}

.modal-overlay.hidden .modal {
  transform: translateY(20px);
}

.modal h3 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.file-info {
  background: rgba(0,0,0,0.2);
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.file-info i {
  font-size: 2rem;
  color: var(--accent-primary);
}

.file-details {
  display: flex;
  flex-direction: column;
}

.file-name {
  font-weight: 600;
  word-break: break-all;
}

.file-size {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  gap: 1rem;
}

.btn {
  flex: 1;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 0 15px var(--accent-glow);
}

.btn-secondary {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--glass-border);
}

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

/* Progress bar */
.progress-container {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 1rem;
}

.progress-bar {
  height: 100%;
  background: var(--accent-primary);
  width: 0%;
  transition: width 0.1s linear;
}

/* Toast Messages */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1000;
}

.toast {
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s ease forwards;
}

.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.share-link-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 20px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 15px var(--accent-glow);
}

.share-link-btn:hover {
  background: #2563eb;
  box-shadow: 0 0 25px var(--accent-glow);
  transform: translateY(-1px);
}

.share-link-btn i {
  font-size: 1.1rem;
}

/* Share Link Box */
.share-link-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  margin-top: 1rem;
}

.share-link-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--accent-primary);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem;
  outline: none;
  min-width: 0;
}

.btn-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-copy:hover {
  background: #2563eb;
}

.share-link-note {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.upload-status {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 0.75rem 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  z-index: 10;
  flex-shrink: 0;
}

.site-footer strong {
  color: var(--text-main);
  font-weight: 600;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.social-links a {
  color: var(--text-muted);
  font-size: 1.25rem;
  transition: color 0.2s ease, transform 0.2s ease;
}

.social-links a:hover {
  color: var(--accent-primary);
  transform: translateY(-2px);
}

.star-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding: 0.4rem 1rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.star-btn:hover {
  color: #fbbf24;
  border-color: #fbbf24;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
}

.star-btn i {
  font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  header {
    padding: 0.9rem 1rem;
    gap: 0.65rem;
    flex-wrap: nowrap;
  }

  .logo {
    font-size: 1.2rem;
    min-width: 0;
  }

  .header-actions {
    width: auto;
    display: flex;
    margin-left: auto;
    gap: 0.6rem;
  }

  .share-link-btn,
  .btn,
  .btn-copy,
  .star-btn {
    min-height: 44px;
  }

  .share-link-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 999px;
    padding: 0;
    font-size: 0 !important;
    gap: 0;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
  }

  .share-link-btn i {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1;
  }

  .status {
    font-size: 0.82rem;
    padding: 0.55rem 0.9rem;
  }

  .radar-container {
    width: min(calc(100vw - 2rem), 360px);
    height: min(calc(100vw - 2rem), 360px);
  }
}

@media (max-width: 480px) {
  .status {
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
  }

  .status #connectionStatusText {
    display: none;
  }
}