:root {
  --bg-primary: #0a0b10;
  --bg-secondary: #12141d;
  --bg-tertiary: #191c28;
  --bg-card: rgba(22, 25, 38, 0.7);
  --bg-card-hover: rgba(30, 34, 52, 0.85);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(79, 172, 254, 0.3);

  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --accent-glow: 0 0 24px rgba(79, 172, 254, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(0, 242, 254, 0.08) 0%, transparent 45%);
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 28px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  box-shadow: var(--accent-glow);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff 30%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-cyan);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #34d399;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.device-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.device-badge:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  color: var(--text-primary);
}

/* Main Layout */
.main-content {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 32px;
  padding-top: 28px;
  flex: 1;
}

/* Stage Section (Left) */
.stage-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Radar Container */
.radar-container {
  position: relative;
  height: 400px;
  background: radial-gradient(circle at center, rgba(30, 41, 67, 0.4) 0%, rgba(10, 11, 16, 0.7) 70%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.radar-pulse {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(79, 172, 254, 0.15);
  pointer-events: none;
}

.ring-1 {
  width: 180px;
  height: 180px;
  animation: radar-expand 4s infinite linear;
}

.ring-2 {
  width: 320px;
  height: 320px;
  animation: radar-expand 4s infinite linear 1.3s;
}

.ring-3 {
  width: 460px;
  height: 460px;
  animation: radar-expand 4s infinite linear 2.6s;
}

@keyframes radar-expand {
  0% { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

.radar-center-node {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: default;
}

.node-avatar {
  width: 72px;
  height: 72px;
  background: var(--bg-card-hover);
  border: 2px solid var(--accent-blue);
  box-shadow: 0 0 28px rgba(79, 172, 254, 0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.node-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.node-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Peers Orbit */
.peers-orbit {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.peer-node {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.peer-avatar {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(0, 242, 254, 0.2));
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 0 24px rgba(0, 242, 254, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  position: relative;
}

.peer-avatar::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 14px;
  height: 14px;
  background-color: var(--accent-emerald);
  border: 2px solid var(--bg-primary);
  border-radius: 50%;
}

.peer-node:hover .peer-avatar {
  transform: scale(1.12);
  box-shadow: 0 0 34px rgba(0, 242, 254, 0.6);
}

.peer-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.peer-badge {
  font-size: 0.68rem;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

/* Helper Card */
.radar-helper-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  text-align: center;
}

.radar-helper-card h3 {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.radar-helper-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Clipboard Hero Banner */
.clipboard-hero-banner {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.banner-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.banner-body {
  flex: 1;
}

.banner-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.banner-title-row h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.banner-body p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.banner-body kbd {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
}

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .3s;
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background: var(--accent-gradient);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Text Beam Card */
.text-beam-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 8px;
}

.beam-input-wrapper {
  display: flex;
  gap: 8px;
}

.beam-input-wrapper input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.beam-input-wrapper input:focus {
  border-color: var(--accent-blue);
}

.btn-beam-send {
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #000;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-beam-send svg {
  width: 16px;
  height: 16px;
}

.btn-beam-send:hover {
  transform: translateY(-1px);
  box-shadow: var(--accent-glow);
}

/* Right Sidebar */
.action-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
}

/* QR Connect Card */
.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title-icon {
  font-size: 1.5rem;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.card-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.qr-preview-box {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  min-height: 200px;
  position: relative;
}

.qr-preview-box img {
  width: 100%;
  max-width: 220px;
  height: auto;
  display: block;
}

.qr-loading {
  position: absolute;
  color: #000;
  font-size: 0.85rem;
  font-weight: 600;
}

.network-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url-copy-box {
  display: flex;
  gap: 6px;
}

.url-copy-box input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  outline: none;
}

/* Dropzone Card */
.dropzone-card {
  border: 2px dashed rgba(79, 172, 254, 0.3);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropzone-card.dragover {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.08);
  box-shadow: var(--accent-glow);
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
}

.dropzone-icon svg {
  width: 24px;
  height: 24px;
}

.dropzone-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.dropzone-content p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Mobile Actions Card */
.mobile-actions-card {
  display: none; /* Shown on mobile viewports */
}

.mobile-actions-header {
  margin-bottom: 16px;
}

.mobile-actions-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.mobile-actions-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.mobile-btn-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-mobile-action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #fff;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.btn-mobile-action.highlight-btn {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.15) 0%, rgba(79, 172, 254, 0.15) 100%);
  border-color: var(--accent-blue);
  box-shadow: 0 4px 20px rgba(79, 172, 254, 0.2);
}

.mobile-btn-icon {
  font-size: 2rem;
  line-height: 1;
}

.mobile-btn-text strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.mobile-btn-text span {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Buttons */
.btn-primary {
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 18px;
  color: #000;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
}

/* Transfer HUD */
.transfer-hud-card {
  border-color: var(--accent-blue);
  background: rgba(18, 20, 29, 0.95);
  box-shadow: var(--accent-glow);
}

.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.hud-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-icon {
  font-size: 1.5rem;
}

.hud-file-info h4 {
  font-size: 0.88rem;
  font-weight: 600;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-meta {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.hud-percent {
  font-size: 1.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.hud-progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 999px;
  overflow: hidden;
}

.hud-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: 999px;
  transition: width 0.15s ease-out;
}

/* Recent Transfers Shelf */
.card-header-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-header-compact h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.history-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 0;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.history-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.history-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #000;
}

.history-file-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.history-details {
  overflow: hidden;
}

.history-name {
  font-size: 0.82rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.badge-copied {
  font-size: 0.65rem;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.history-actions {
  display: flex;
  gap: 6px;
}

.btn-icon-action {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.btn-icon-action:hover {
  background: var(--bg-card-hover);
  color: #fff;
  border-color: var(--accent-blue);
}

/* Floating Toast */
.clipboard-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: rgba(18, 20, 29, 0.95);
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 10px 40px rgba(0, 242, 254, 0.35);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 1000;
  backdrop-filter: blur(16px);
  transform: translateY(100px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.clipboard-toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-icon {
  font-size: 1.6rem;
}

.toast-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}

.toast-desc {
  font-size: 0.8rem;
  color: var(--accent-cyan);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

/* Mobile Responsive Optimization */
@media (max-width: 900px) {
  .app-container {
    padding: 16px;
  }

  .main-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .radar-container {
    height: 300px;
  }

  /* On mobile phone viewport, hide desktop QR and show prominent touch buttons */
  .qr-connect-card {
    display: none;
  }

  .clipboard-hero-banner {
    display: none;
  }

  .dropzone-card {
    display: none;
  }

  .mobile-actions-card {
    display: block;
  }
}
