:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #10b981;
    --danger-color: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Background Animated Blobs */
.background-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.5;
}

.blob-1 {
    top: -100px;
    left: -100px;
    width: 400px;
    height: 400px;
    background: #3b82f6;
    animation: float 10s ease-in-out infinite;
}

.blob-2 {
    bottom: -150px;
    right: -100px;
    width: 500px;
    height: 500px;
    background: #8b5cf6;
    animation: float 12s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(20px) scale(1.05); }
}

/* Glass Header */
.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 600px) {
    .glass-header {
        padding: 0.8rem 1rem;
        justify-content: center;
    }
    .logo {
        margin-right: auto;
    }
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.my-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-secondary); /* default connecting */
}
.status-indicator.connected {
    background: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
}
.status-indicator.disconnected {
    background: var(--danger-color);
    box-shadow: 0 0 10px var(--danger-color);
}

/* Buttons */
.glass-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.glass-button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.glass-button.primary {
    background: var(--primary-color);
    border-color: transparent;
}

.glass-button.primary:hover {
    background: var(--primary-hover);
}

/* Radar Container (Main Area) */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

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

.radar-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px dashed rgba(255,255,255,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
}

.radar-scan {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(rgba(59, 130, 246, 0.4) 0deg, transparent 60deg);
    animation: scan 4s linear infinite;
}

@keyframes scan {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Devices */
.device {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.device.self {
    z-index: 5;
}

.device-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.device:hover .device-icon {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    border-color: rgba(59, 130, 246, 0.5);
}

.device-name {
    font-size: 0.875rem;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    text-align: center;
    max-width: 100px;
    word-wrap: break-word;
}

/* Peer positioning around the circle */
.peer-device {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -50px; /* half of icon + text approx height */
    margin-left: -32px; /* half of icon width */
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    opacity: 1;
    transition: opacity 0.3s ease;
}

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

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

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

.glass-panel h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.glass-panel p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.code-inputs input {
    width: 100%;
    padding: 1rem;
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 0.5rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: white;
    outline: none;
    transition: border-color 0.3s;
}

.code-inputs input:focus {
    border-color: var(--primary-color);
}

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

.modal-actions button {
    flex: 1;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 999px;
    overflow: hidden;
    margin: 1rem 0;
}

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

.percentage {
    font-weight: bold;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}
