/* ========================================= */
/* 1. VARIABLES & BASE SETUP                 */
/* ========================================= */
:root {
  /* --- CORE THEME: Deep Space Glass --- */
  --bg-dark: #0f172a;
  --bg-gradient: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 100%);
  
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.1);
  --surface-highlight: rgba(255, 255, 255, 0.05);
  
  --primary-color: #38bdf8; /* Sky Blue */
  --accent-color: #818cf8;  /* Indigo */
  --success-color: #34d399;
  --danger-color: #f472b6;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  /* --- SPACING & UI --- */
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --glass: blur(20px);
  --shadow-soft: 0 10px 40px -10px rgba(0,0,0,0.5);
  --trans-fast: 0.2s ease;
  --trans-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body { 
  margin: 0; 
  font-family: 'Inter', system-ui, -apple-system, sans-serif; 
  background: var(--bg-dark);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 40px;
  overflow-x: hidden;
  font-size: 16px;
}

/* ========================================= */
/* 2. LAYOUT & HEADER                        */
/* ========================================= */
.container { 
  display: block; 
  margin: 0 auto; 
  padding: 0 0px; 
  max-width: 600px; 
  width: 100%; 
  position: relative;
  z-index: 10;
}

.hdr {        
    width: 100%; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    margin-bottom: 10px;
}
    
.logo { width: 48px; height: auto; filter: drop-shadow(0 0 15px rgba(56, 189, 248, 0.4)); }

.card { 
  background: var(--card-bg);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  padding: 30px; 
  border-radius: var(--radius-lg); 
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-soft); 
  display: flex; 
  flex-direction: column; 
  width: 100%;
  transition: transform var(--trans-spring);
}

.title-head { 
  font-size: 24px; 
  color: #fff; 
  text-align: center; 
  margin: 0 0 10px 0; 
  font-weight: 700; 
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ftr { 
    text-align: center; margin-top: 40px; font-size: 13px; 
    color: var(--text-muted); opacity: 0.7; 
}

.hidden { display: none !important; }

/* ========================================= */
/* 3. MENU & NAVIGATION (SIDEBAR)            */
/* ========================================= */
.menu-trigger {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--surface-highlight);
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; z-index: 101;
    transition: var(--trans-fast);
}
.menu-trigger:active { transform: scale(0.9); }
.menu-trigger span, .menu-trigger::before, .menu-trigger::after {
    content: ''; display: block; width: 20px; height: 2px;
    background: #fff; border-radius: 2px;
    position: absolute; transition: var(--trans-fast);
}
.menu-trigger span { opacity: 1; }
.menu-trigger::before { transform: translateY(-6px); }
.menu-trigger::after { transform: translateY(6px); }

.menu-trigger.active span { opacity: 0; }
.menu-trigger.active::before { transform: rotate(45deg); }
.menu-trigger.active::after { transform: rotate(-45deg); }

.side-panel {
    position: fixed; top: 0; left: 0;
    height: 100%; width: 280px; max-width: 85vw;
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid var(--card-border);
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9998;
    display: flex; flex-direction: column;
}
.side-panel.open { transform: translateX(0); box-shadow: 50px 0 100px rgba(0,0,0,0.5); }

.sp-header {
    padding: 60px 25px 30px;
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.1), transparent);
}
.sp-title {
    font-size: 20px; color: #fff; font-weight: 800; letter-spacing: -0.5px; margin: 0;
}
.sp-dialog { font-size: 12px; color: var(--primary-color); margin-top: 5px; opacity: 0.8; }

.sp-content { flex: 1; overflow-y: auto; padding: 10px; }

.sp-link {
    display: flex; align-items: center; padding: 16px 20px; margin-bottom: 5px;
    color: var(--text-muted); text-decoration: none; font-size: 15px; font-weight: 500;
    border-radius: var(--radius-sm); transition: var(--trans-fast);
}
.sp-link:hover, .sp-link.active-sub {
    background: var(--surface-highlight); color: #fff;
}
.sp-link .icon { width: 24px; margin-right: 15px; font-size: 18px; }

.submenu-items { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; padding-left: 10px; }
.submenu-items.show { max-height: 200px; }
.sub-link {
    display: block; padding: 12px 15px 12px 50px; border-radius: var(--radius-sm);
    color: var(--text-muted); font-size: 14px; text-decoration: none;
}
.sub-link:hover { color: var(--primary-color); background: rgba(255,255,255,0.02); }

.sp-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(5px);
    z-index: 9997; opacity: 0; pointer-events: none; transition: 0.3s;
}
.sp-overlay.active { opacity: 1; pointer-events: auto; }

/* ========================================= */
/* 4. TABS & INTERACTION                     */
/* ========================================= */
.tabs {
    display: flex; background: rgba(0,0,0,0.3);
    padding: 4px; border-radius: 50px; margin-bottom: 30px;
    border: 1px solid var(--card-border);
    position: relative;
}
.tab-btn {
    flex: 1; background: transparent; border: none;
    padding: 10px; color: var(--text-muted);
    font-size: 13px; font-weight: 600; cursor: pointer;
    border-radius: 40px; transition: var(--trans-fast); z-index: 2;
}
.tab-btn.active {
    background: var(--surface-highlight); color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

input[type="text"], input[type="url"], input[type="number"], input[type="password"], input[type="email"], select {
    width: 100%; padding: 16px 20px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid transparent;
    color: #fff; border-radius: var(--radius-md);
    font-size: 16px; outline: none; transition: var(--trans-fast);
}
input:focus, select:focus { 
    border-color: var(--primary-color); 
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1); 
}

.btn {
    border: none; border-radius: 50px; padding: 16px 24px;
    font-size: 15px; font-weight: 700; cursor: pointer;
    transition: var(--trans-fast); display: inline-flex;
    justify-content: center; align-items: center; gap: 8px;
}
.btn.primary {
    background: var(--primary-color); color: #0f172a; width: 100%;
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.3);
}
.btn.primary:active { transform: scale(0.98); }

.btn.ghost { background: rgba(255,255,255,0.1); color: #fff; }
.btn.small { padding: 8px 16px; font-size: 12px; }

.drop {
    border: 2px dashed rgba(255,255,255,0.15); border-radius: var(--radius-md);
    height: 180px; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.2); cursor: pointer; transition: 0.3s;
    position: relative; overflow: hidden; margin-top: 20px;
}
.drop:hover { border-color: var(--primary-color); background: rgba(56, 189, 248, 0.05); }
.drop input { position: absolute; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-inner strong { display: block; font-size: 18px; color: #fff; margin-bottom: 8px; }

.progress { height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; margin-top: 15px; }
.bar { height: 100%; background: var(--success-color); width: 0%; transition: width 0.2s; }
.pct { text-align: right; font-size: 12px; color: var(--success-color); margin-top: 5px; font-weight: bold; }

/* ========================================= */
/* 5. NEARBY / RADAR UI (HOLOGRAPHIC TECH)   */
/* ========================================= */

.radar-container {
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md); 
    padding: 40px 20px;
    margin-bottom: 25px; 
    position: relative;
    display: flex; 
    flex-direction: column; 
    align-items: center;
    overflow: hidden; 
    box-shadow: inset 0 0 60px rgba(0,0,0,0.5);
}

/* Optional: Add a grid background to the container for extra tech feel */
.radar-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

/* The Main Radar Circle */
.radar {
    width: 140px; 
    height: 140px; 
    margin-bottom: 25px;
    border-radius: 50%; 
    position: relative; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    z-index: 1;
    /* Glassy/Screen Look */
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(56, 189, 248, 0.3);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.1), inset 0 0 20px rgba(56, 189, 248, 0.1);
}

/* Decorative: Static Crosshairs */
.radar::after {
    content: '+'; 
    font-family: monospace;
    font-size: 24px; 
    color: rgba(56, 189, 248, 0.5);
    z-index: 2;
}

/* Decorative: Rotating Outer Ring */
.radar::before {
    content: '';
    position: absolute;
    top: -8px; left: -8px; right: -8px; bottom: -8px;
    border: 1px dashed rgba(56, 189, 248, 0.3);
    border-radius: 50%;
    animation: techRotate 10s linear infinite;
}

/* The Sweeping Beam (Scanner) */
.radar .scanner {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 96%; height: 96%; /* Slightly smaller than container */
    border-radius: 50%;
    z-index: 1;
    
    /* The Magic: Conic Gradient for the Radar Sweep */
    background: conic-gradient(
        from 0deg, 
        transparent 0%, 
        transparent 60%, 
        rgba(56, 189, 248, 0.1) 80%, 
        rgba(56, 189, 248, 0.8) 100%
    );
    
    /* Soften edges */
    filter: blur(1px);
    animation: radarSweep 2s linear infinite;
}

/* --- ACTIVE STATE (When searching) --- */
.radar.active {
    border-color: var(--success-color);
    box-shadow: 0 0 30px rgba(52, 211, 153, 0.2), inset 0 0 20px rgba(52, 211, 153, 0.2);
}

.radar.active::before {
    border-color: rgba(52, 211, 153, 0.3);
    animation-duration: 5s; /* Faster spin */
}

.radar.active::after {
    color: var(--success-color);
    text-shadow: 0 0 10px var(--success-color);
}

.radar.active .scanner {
    /* Switch beam color to green */
    background: conic-gradient(
        from 0deg, 
        transparent 0%, 
        transparent 50%, 
        rgba(52, 211, 153, 0.1) 80%, 
        var(--success-color) 100%
    );
    animation: radarSweep 1.2s linear infinite; /* Faster sweep */
}

/* New Animation: Shockwave Emitter (Pseudo-element on scanner when active) */
.radar.active .scanner::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 10px; height: 10px;
    border: 2px solid var(--success-color);
    border-radius: 50%;
    opacity: 0;
    animation: sonarPing 1.5s ease-out infinite;
}

/* --- TEXT STATUS --- */
.radar-status {
    font-family: 'Inter', monospace;
    font-size: 12px; 
    color: var(--text-muted);
    letter-spacing: 2px;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(0,0,0,0.3);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.05);
}

.radar.active + .radar-status {
    color: var(--success-color);
    border-color: rgba(52, 211, 153, 0.3);
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.1);
    animation: textPulse 1s ease-in-out infinite alternate;
}

/* --- ANIMATIONS --- */
@keyframes radarSweep {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes techRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes sonarPing {
    0% { width: 10px; height: 10px; opacity: 0.8; border-width: 2px; }
    100% { width: 100%; height: 100%; opacity: 0; border-width: 0px; }
}

@keyframes textPulse {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

/* ========================================= */
/* ALIGN BUTTONS IN ONE ROW                  */
/* ========================================= */

.nearby-controls { 
    display: flex; 
    flex-direction: row; /* Force horizontal alignment */
    gap: 15px; 
    margin-top: 20px; 
    width: 100%; 
}

.btn.tech {
    flex: 1; /* Makes them split the width 50/50 */
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary-color); 
    font-weight: 600;
    padding: 14px; 
    border-radius: var(--radius-sm);
    border: 1px solid rgba(56, 189, 248, 0.2);
    white-space: nowrap; /* Prevents text wrapping */
}

.btn.tech:hover { 
    background: var(--primary-color); 
    color: #0f172a; 
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4); 
}

.btn.tech.recv { 
    color: var(--success-color); 
    background: rgba(52, 211, 153, 0.1); 
    border-color: rgba(52, 211, 153, 0.2); 
}

.btn.tech.recv:hover { 
    background: var(--success-color); 
    color: #0f172a; 
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.4); 
}

/* === CRITICAL FIX: Prevent Mobile Stacking === */
@media (max-width: 480px) {
    .nearby-controls { 
        flex-direction: row !important; /* Forces row on mobile */
    }
}

/* --- PEER LIST --- */
#peers-container { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; }
.peer-item {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1);
    padding: 15px 20px; border-radius: 12px; cursor: pointer; transition: all 0.2s ease;
    animation: slideUp 0.3s ease forwards;
}
.peer-item:hover { 
    background: rgba(56, 189, 248, 0.1); border-color: var(--primary-color); 
    transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.peer-name { font-weight: 600; color: #fff; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.peer-name::before { content: '📱'; font-size: 18px; }
.peer-icon { 
    color: var(--text-muted); font-size: 12px; background: rgba(255,255,255,0.1);
    padding: 6px 12px; border-radius: 20px; transition: 0.2s;
}
.peer-item:hover .peer-icon { background: var(--primary-color); color: #0f172a; font-weight: bold; }
.peer-item:hover .peer-icon::after { content: ' Connect'; }

/* --- INCOMING REQUEST MODAL --- */
#security-scan-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px);
    z-index: 20000; display: flex; justify-content: center; align-items: center; padding: 20px;
}
.scan-card {
    background: #1e293b; border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%; max-width: 360px; border-radius: 24px; overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex; flex-direction: column;
}
.scan-header {
    padding: 20px 25px; background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05); display: flex; align-items: center; gap: 15px;
}
.scan-status-dot {
    width: 10px; height: 10px; background: var(--success-color);
    border-radius: 50%; box-shadow: 0 0 10px var(--success-color); animation: pulseDot 2s infinite;
}
.scan-title { font-size: 11px; font-weight: 700; color: var(--primary-color); letter-spacing: 1px; display:block;}
.scan-subtitle { font-size: 13px; color: #fff; margin-top: 2px; }

.scan-body { padding: 30px 25px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.scan-icon-wrapper {
    width: 80px; height: 80px; background: rgba(255, 255, 255, 0.05);
    border-radius: 20px; display: flex; justify-content: center; align-items: center;
    margin-bottom: 20px; border: 1px solid rgba(255, 255, 255, 0.1);
}
.file-icon-large { font-size: 40px; }
#scan-filename { margin: 0; font-size: 18px; color: #fff; line-height: 1.4; word-break: break-all; }
#scan-filesize { margin: 5px 0 15px 0; font-size: 14px; color: var(--text-muted); }
.scan-badge { font-size: 10px; background: rgba(255,255,255,0.1); padding: 4px 8px; border-radius: 4px; color: var(--text-muted); }

.scan-actions { padding: 20px; display: flex; gap: 15px; background: rgba(0,0,0,0.2); }
.btn-modal {
    flex: 1; padding: 15px; border-radius: 12px; font-weight: 700; font-size: 13px;
    cursor: pointer; border: none; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s;
}
.btn-modal.reject { background: transparent; color: var(--danger-color); border: 1px solid rgba(244, 114, 182, 0.2); }
.btn-modal.reject:hover { background: rgba(244, 114, 182, 0.1); }
.btn-modal.accept { background: var(--success-color); color: #0f172a; box-shadow: 0 4px 15px rgba(52, 211, 153, 0.3); }
.btn-modal.accept:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(52, 211, 153, 0.4); }

/* --- UNLOCK DIALOG --- */
#nearby-unlock-area {
    background: rgba(20, 20, 30, 0.9);
    border: 1px solid var(--danger-color);
    padding: 20px; border-radius: 16px; margin-top: 20px;
    text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#nearby-unlock-area p {
    color: var(--danger-color); font-weight: 700; margin-bottom: 15px; 
    font-size: 14px; letter-spacing: 0.5px; text-transform: uppercase;
}
#recv-pin {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    font-family: monospace; font-size: 24px; letter-spacing: 8px;
    color: #fff; width: 140px !important; text-align: center;
    padding: 10px; border-radius: 8px; transition: 0.2s;
}
#recv-pin:focus {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.2); outline: none;
}
#recv-unlock-btn {
    background: var(--danger-color); color: #fff; border-radius: 8px; font-weight: bold; padding: 0 20px;
}

/* --- OTHER --- */
.holo-card {
    background: rgba(15, 23, 42, 0.8) !important; 
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    box-shadow: 0 10px 30px -5px rgba(0,0,0,0.5) !important;
}
.auth-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(15px);
    z-index: 10000; display: flex; justify-content: center; align-items: center;
}
.auth-card {
    background: #1e293b; width: 90%; max-width: 400px;
    padding: 15px; border-radius: 24px; border: 1px solid var(--card-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.auth-tabs { display: flex; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 25px; }
.auth-tabs button { 
    flex: 1; background: none; border: none; color: var(--text-muted); 
    padding: 15px; font-weight: 600; cursor: pointer; 
    border-bottom: 2px solid transparent; 
}
.auth-tabs button.active { color: #fff; border-bottom-color: var(--primary-color); }

.profile-icon {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--surface-highlight);
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; transition: 0.2s; 
}
.profile-icon:hover { background: rgba(255,255,255,0.15); }

#close-auth {
  float: right;
}


/* --- PROFILE UI --- */
.auth-card.profile-mode {
    max-width: 500px; padding: 0; overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.profile-banner {
    height: 110px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(129, 140, 248, 0.2));
    position: relative; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.profile-avatar-large {
    display: none !important;
    width: 86px; height: 86px; background: #0f172a;
    border: 4px solid #1e293b; border-radius: 50%;
    position: absolute; bottom: -43px; left: 50%; transform: translateX(-50%);
    display: flex; justify-content: center; align-items: center;
    font-size: 32px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 2;
}
.profile-body { padding: 50px 0px 30px 0px; text-align: center; }
.profile-name { margin: 0; font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -0.5px; }
.profile-id-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1);
    padding: 6px 14px; border-radius: 20px; margin-top: 8px; margin-bottom: 20px;
    font-size: 12px; color: var(--text-muted); font-family: monospace;
    cursor: pointer; transition: 0.2s;
}
.profile-id-badge:hover { border-color: var(--primary-color); color: var(--primary-color); background: rgba(56, 189, 248, 0.05); }
.profile-actions-top { position: absolute; top: 15px; right: 15px; z-index: 5; display: flex; gap: 10px; }
.btn-icon-only {
    background: rgba(0,0,0,0.3); border: none; color: #fff; width: 32px; height: 32px;
    border-radius: 50%; cursor: pointer; display: flex; justify-content: center; align-items: center;
    transition: 0.2s;
}
.btn-icon-only:hover { background: rgba(255,255,255,0.2); }
.btn-icon-only.red:hover { background: var(--danger-color); }

.list-container { max-height: 250px; overflow-y: auto; text-align: left; margin-top: 15px; padding-right: 5px; }
.list-container::-webkit-scrollbar { width: 4px; }
.list-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.friend-card {
    background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05);
    padding: 12px 15px; margin-bottom: 8px; border-radius: 12px;
    display: flex; justify-content: space-between; align-items: center; transition: 0.2s;
}
.friend-card:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); transform: translateX(2px); }
.f-info { display: flex; flex-direction: column; }
.f-name { font-weight: 600; font-size: 14px; color: #e2e8f0; }
.f-status { font-size: 11px; color: var(--success-color); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.on-dot { width: 6px; height: 6px; background: var(--success-color); border-radius: 50%; }

.inbox-item {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.05), transparent);
    border-left: 3px solid var(--primary-color);
    padding: 12px 15px; margin-bottom: 8px; border-radius: 4px 12px 12px 4px;
    display: flex; justify-content: space-between; align-items: center;
}
.inbox-info strong { display: block; font-size: 14px; color: #fff; margin-bottom: 2px; }
.inbox-meta { font-size: 11px; color: var(--text-muted); }

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes popIn { 0% { transform: scale(0.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulseDot { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Mobile Optimizations */
@media (max-width: 480px) {
    .hdr { padding: 15px 20px; }
    .card { padding: 20px; border-radius: 0 0 20px 20px; border-left: none; border-right: none; }
    .nearby-controls { flex-direction: column; }
    .drop { height: 140px; }
}

/* ========================================= */
/* HUD DEVICE LABELS (OUTSIDE CIRCLE)        */
/* ========================================= */

/* The Floating Device Tag */
.radar-blip {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 4px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    animation: slideInHUD 0.4s ease-out;
    max-width: 140px; /* Prevent huge names */
}

.radar-blip:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--success-color);
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.2);
}

/* The Status Dot inside the tag */
.radar-blip .dot {
    width: 8px; height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success-color);
    flex-shrink: 0;
}

/* The Name Text */
.radar-blip .label {
    font-family: 'Inter', monospace;
    font-size: 11px;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
}

/* Optional: Connecting line decoration */
.radar-blip::before {
    content: '';
    position: absolute;
    width: 15px; height: 1px;
    background: rgba(56, 189, 248, 0.3);
}

@keyframes slideInHUD {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* ========================================= */
/* 6. ROUTE.PHP (PROTECTED FILE) INTEGRATION */
/* ========================================= */

/* These styles strictly target the HTML structure generated by route.php
   to ensure it matches the "Deep Space" theme without changing PHP code.
*/

/* --- 1. PIN CARD STYLING --- */
/* We target the card specifically when it contains the pin input */
.card:has(input[name="pin"]) {
    max-width: 400px;
    width: 90%;
    margin: 0 auto;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    text-align: center;
}

/* Style the Lock Icon (The div with font-size: 50px) */
.card:has(input[name="pin"]) div[style*="font-size: 50px"] {
    text-shadow: 0 0 30px var(--primary-color);
    filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.4));
    animation: floatIcon 3s ease-in-out infinite;
    margin-bottom: 10px !important;
}

/* Headings & Text */
.card:has(input[name="pin"]) h2 {
    color: #fff;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 5px;
}

.card:has(input[name="pin"]) p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 25px;
}

/* --- 2. FORM ELEMENTS --- */

/* PIN Input Field - Overriding inline styles using !important where necessary */
input[name="pin"] {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(56, 189, 248, 0.2) !important;
    color: var(--primary-color) !important;
    font-family: 'Inter', monospace;
    font-size: 24px !important;
    letter-spacing: 8px;
    text-align: center !important;
    border-radius: var(--radius-md) !important;
    padding: 15px !important;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
    transition: var(--trans-fast);
}

input[name="pin"]:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2), inset 0 2px 10px rgba(0,0,0,0.5) !important;
    outline: none;
}

/* Unlock Button - Replacing Gold with Theme Blue */
.card button[type="submit"] {
    background: var(--primary-color) !important;
    color: #0f172a !important;
    font-weight: 800 !important;
    border: none !important;
    padding: 16px !important;
    border-radius: 50px !important;
    font-size: 16px !important;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    margin-top: 10px;
}

.card button[type="submit"]:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.6) !important;
}

/* Error Message */
.error {
    color: var(--danger-color) !important;
    background: rgba(244, 114, 182, 0.1);
    border: 1px solid rgba(244, 114, 182, 0.2);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 13px !important;
    font-weight: 600;
    margin-bottom: 20px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* --- 3. 404 PAGE STYLING --- */
/* Targeting the 404 link */
a[href="/"][style*="color:#d4af37"] {
    color: var(--primary-color) !important; /* Switch gold to blue */
    text-decoration: none;
    font-weight: 700;
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 10px 24px;
    border-radius: 50px;
    margin-top: 20px;
    display: inline-block;
    transition: 0.3s;
}

a[href="/"]:hover {
    background: rgba(56, 189, 248, 0.1);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

/* Animation for the lock icon */
@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}