@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

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

  /* Theme 1: Emerald Pro (Default Dark) */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-tertiary: #1f293d;
  --bg-glass: rgba(17, 24, 39, 0.75);
  --bg-glass-card: rgba(31, 41, 61, 0.6);
  --bg-glass-hover: rgba(55, 65, 81, 0.5);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(16, 185, 129, 0.5);

  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent: #10b981;
  --accent-hover: #059669;
  --accent-light: rgba(16, 185, 129, 0.15);
  --accent-glow: 0 0 25px rgba(16, 185, 129, 0.35);

  --cyan: #06b6d4;
  --blue: #3b82f6;
  --indigo: #6366f1;
  --purple: #8b5cf6;
  --rose: #f43f5e;
  --amber: #f59e0b;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Theme 2: Solar Frost (Light Minimal) */
[data-theme="light"] {
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e5e7eb;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-glass-card: rgba(255, 255, 255, 0.7);
  --bg-glass-hover: rgba(243, 244, 246, 0.8);

  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(16, 185, 129, 0.6);

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  --accent: #059669;
  --accent-hover: #047857;
  --accent-light: rgba(5, 150, 105, 0.12);
  --accent-glow: 0 0 20px rgba(5, 150, 105, 0.25);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.12);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

/* Theme 3: Cyberpunk Neon */
[data-theme="cyberpunk"] {
  --bg-primary: #05050b;
  --bg-secondary: #0d0e1a;
  --bg-tertiary: #191b30;
  --bg-glass: rgba(13, 14, 26, 0.85);
  --bg-glass-card: rgba(25, 27, 48, 0.65);
  --bg-glass-hover: rgba(45, 48, 85, 0.6);

  --border-color: rgba(236, 72, 153, 0.25);
  --border-focus: #ec4899;

  --text-primary: #ffffff;
  --text-secondary: #a5b4fc;
  --text-muted: #6366f1;

  --accent: #06b6d4;
  --accent-hover: #0891b2;
  --accent-light: rgba(6, 182, 212, 0.18);
  --accent-glow: 0 0 25px rgba(6, 182, 212, 0.5);
}

/* Theme 4: Midnight OLED (True Black) */
[data-theme="midnight"] {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0f;
  --bg-tertiary: #14141e;
  --bg-glass: rgba(10, 10, 15, 0.85);
  --bg-glass-card: rgba(20, 20, 30, 0.7);
  --bg-glass-hover: rgba(30, 30, 45, 0.6);

  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: #3b82f6;

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

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: rgba(59, 130, 246, 0.18);
  --accent-glow: 0 0 25px rgba(59, 130, 246, 0.45);
}

/* Theme 5: Sunset Amber (Warm Gold & Coral) */
[data-theme="sunset"] {
  --bg-primary: #0f0b08;
  --bg-secondary: #1a1410;
  --bg-tertiary: #2a201a;
  --bg-glass: rgba(26, 20, 16, 0.85);
  --bg-glass-card: rgba(42, 32, 26, 0.7);
  --bg-glass-hover: rgba(60, 46, 38, 0.6);

  --border-color: rgba(245, 158, 11, 0.2);
  --border-focus: #f59e0b;

  --text-primary: #fffbeb;
  --text-secondary: #d97706;
  --text-muted: #92400e;

  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-light: rgba(245, 158, 11, 0.18);
  --accent-glow: 0 0 25px rgba(245, 158, 11, 0.45);
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  background-image: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
}

/* Focus Visible Accessibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-glass);
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  padding: 0.75rem 0;
  border-top: none;
  border-left: none;
  border-right: none;
}

.app-header-inner {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .app-header-inner {
    padding: 0 1.5rem;
  }
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  user-select: none;
}

.brand-logo-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, var(--cyan) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #042f2e;
  font-weight: 800;
  box-shadow: var(--accent-glow);
  transition: transform var(--transition-spring);
}

.brand-logo-wrap:hover {
  transform: scale(1.08) rotate(-4deg);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.room-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  font-family: var(--font-mono);
}

.room-chip:hover {
  border-color: var(--border-focus);
  background: var(--bg-glass-hover);
  transform: translateY(-1px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-dot 2s infinite ease-in-out;
}

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

@keyframes spin-smooth {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spin-smooth,
.animate-spin {
  display: inline-block;
  transform-origin: 50% 50%;
  animation: spin-smooth 1.1s linear infinite;
  will-change: transform;
}

/* Icon Buttons */
.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-focus);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-icon.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--border-focus);
}

.header-transfer-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #6366f1;
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg-secondary);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.5);
  animation: pulse-dot 1.5s infinite;
}

.transfer-tab-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.transfer-tab-btn.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--border-focus);
  font-weight: 700;
}

/* Main Container Layout */
.app-container {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1rem 6rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .app-container {
    padding: 1.5rem 1.5rem 2rem 1.5rem;
    gap: 1.5rem;
  }
}

/* Self Device Card */
.self-device-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.self-device-card:hover {
  border-color: var(--border-focus);
}

.self-info-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.self-profile-top-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.self-avatar-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.os-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

.self-details {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.self-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.self-name-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.self-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.btn-edit-name {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 4px;
  transition: color var(--transition-fast);
}

.btn-edit-name:hover {
  color: var(--accent);
}

.self-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

/* Mini QR & Quick Share */
.self-qr-share-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-tertiary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.mini-qr-wrapper {
  width: 44px;
  height: 44px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2px;
  transition: transform var(--transition-fast);
}

.mini-qr-wrapper:hover {
  transform: scale(1.06);
}

.mini-qr-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.mini-share-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.mini-room-code-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  white-space: nowrap;
}

.mini-room-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.mini-room-code {
  font-size: 0.85rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.btn-mini-share {
  background: var(--accent-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent);
  padding: 0.18rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  gap: 0.25rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-mini-share:hover {
  background: var(--accent);
  color: #042f2e;
}

/* Quick Action Bar */
.quick-action-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.action-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: all var(--transition-spring);
  user-select: none;
}

.action-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-focus);
  background: var(--bg-glass-hover);
  box-shadow: var(--shadow-sm);
}

.action-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-spring);
}

.action-card:hover .action-icon-circle {
  transform: scale(1.1);
}

.action-icon-files { background: rgba(16, 185, 129, 0.15); color: var(--accent); }
.action-icon-folder { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.action-icon-text { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.action-icon-clip { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.action-card-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.action-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.action-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: none;
}

@media (min-width: 640px) {
  .action-subtitle {
    display: block;
  }
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #042f2e;
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--accent-glow);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-focus);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.btn-danger:hover {
  background: var(--rose);
  color: #ffffff;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  padding: 4px 8px;
  padding-bottom: max(6px, env(safe-area-inset-bottom, 6px));
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex: 1;
  max-width: 68px;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item:active {
  transform: scale(0.92);
}

.mobile-nav-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 11px; /* Semi-square squircle */
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.nav-icon-radar { background: linear-gradient(135deg, #10b981, #059669); }
.nav-icon-devices { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.nav-icon-transfers { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.nav-icon-files { background: linear-gradient(135deg, #10b981, #059669); }
.nav-icon-folder { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.nav-icon-text { background: linear-gradient(135deg, #ec4899, #d946ef); }
.nav-icon-clip { background: linear-gradient(135deg, #f59e0b, #d97706); }
.nav-icon-qr { background: linear-gradient(135deg, #06b6d4, #0891b2); }

.nav-transfer-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--rose);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg-secondary);
  box-shadow: 0 2px 6px rgba(244, 63, 94, 0.5);
  animation: pulse-dot 1.5s infinite;
}

.mobile-nav-item.active .mobile-nav-icon-wrap {
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
  border: 1.5px solid rgba(255, 255, 255, 0.6);
}

.mobile-nav-item.active .mobile-nav-label {
  color: var(--accent);
  font-weight: 800;
}

.mobile-nav-item:hover .mobile-nav-icon-wrap,
.mobile-nav-item:focus .mobile-nav-icon-wrap {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.mobile-nav-icon-wrap svg {
  width: 22px;
  height: 22px;
}

.mobile-nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.mobile-nav-item:hover .mobile-nav-label {
  color: var(--text-primary);
}

/* Toast Container */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
  animation: slide-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: all var(--transition-normal);
}

.toast.toast-success { border-left: 4px solid var(--accent); }
.toast.toast-info { border-left: 4px solid var(--cyan); }
.toast.toast-warning { border-left: 4px solid var(--amber); }
.toast.toast-error { border-left: 4px solid var(--rose); }

@keyframes slide-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ========================================================= */
/* Responsive Mobile App View (Zero Scroll, App-Like Layout)  */
/* ========================================================= */
@media (max-width: 768px) {
  html, body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden; /* Native app-like zero scroll */
  }

  .app-header {
    padding: 0.45rem 0.75rem;
    flex-shrink: 0;
  }

  .app-header-inner {
    padding: 0;
  }

  /* Hide redundant room chip and qr button from top bar in mobile */
  #room-chip,
  #btn-open-qr {
    display: none !important;
  }

  .brand-logo-wrap {
    width: 32px;
    height: 32px;
  }

  .brand-title {
    font-size: 1rem;
  }
  
  .app-container {
    padding: 0.45rem 0.75rem;
    /* Exactly 8dp clearance above the 64px fixed mobile bottom nav bar */
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    gap: 0.45rem;
    height: calc(100dvh - 48px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }

  .self-device-card {
    flex-shrink: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    border-radius: 12px;
  }

  .self-info-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .self-profile-top-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .self-avatar-wrap {
    width: 34px;
    height: 34px;
    font-size: 1.2rem;
    border-radius: 9px;
  }

  .self-name {
    font-size: 0.9rem;
  }

  .self-status-indicator {
    font-size: 0.68rem;
  }

  .mini-qr-wrapper {
    width: 36px;
    height: 36px;
    padding: 2px;
  }

  .mini-qr-canvas {
    width: 32px !important;
    height: 32px !important;
  }

  .discovery-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }

  .section-header {
    flex-shrink: 0;
  }

  .section-title {
    font-size: 0.88rem;
  }

  .radar-card {
    flex: 1;
    min-height: 0; /* Auto shrink to perfectly fit remaining screen height */
    height: 100%;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(16, 185, 129, 0.15);
    margin-bottom: 4px; /* Explicit gap above bottom nav bar */
  }

  .radar-stage {
    transform: none; /* Full card expansion */
    width: 100%;
    height: 100%;
  }

  .radar-sweep {
    width: 100%;
    height: 100%;
    min-width: 480px;
    min-height: 480px;
  }

  .beacon-avatar {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
  }

  .empty-radar-message {
    bottom: 38px; /* Lifted high above the bottom border */
    font-size: 0.75rem;
    padding: 0.4rem 0.85rem;
    z-index: 50;
    white-space: nowrap;
    max-width: 90%;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(16, 185, 129, 0.3);
  }

  /* Hide the top horizontal action cards in mobile (since they are in bottom nav) */
  .quick-action-bar {
    display: none;
  }

  /* Show the native bottom navigation bar */
  .mobile-bottom-nav {
    display: flex;
  }

  #toast-container {
    left: 16px;
    right: 16px;
    bottom: 74px;
  }

  .toast {
    min-width: unset;
    width: 100%;
  }

  /* Hide transfers header on mobile when there are no active transfers */
  #transfers-section:not(.has-transfers) {
    display: none;
  }

  .transfers-section.has-transfers {
    flex-shrink: 0;
    max-height: 120px;
    overflow-y: auto;
  }
}
