:root {
    --bg-dark: #0a0b0f;
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.3);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Utilities */
.hidden { display: none !important; }
.view {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}
.view.active {
    opacity: 1;
    pointer-events: auto;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

/* Landing Page */
#landing-page {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Animated background blobs */
.blob {
    position: absolute;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.35;
}
.blob-1 {
    top: -15%; left: -10%;
    width: 500px; height: 500px;
    background: #4f46e5;
    border-radius: 50%;
    animation: float1 12s infinite alternate ease-in-out;
}
.blob-2 {
    bottom: -15%; right: -10%;
    width: 550px; height: 550px;
    background: #ec4899;
    border-radius: 50%;
    animation: float2 14s infinite alternate-reverse ease-in-out;
}
.blob-3 {
    top: 50%; left: 60%;
    width: 350px; height: 350px;
    background: #8b5cf6;
    border-radius: 50%;
    animation: float3 10s infinite alternate ease-in-out;
    opacity: 0.2;
}

@keyframes float1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 40px) scale(1.1); }
}
@keyframes float2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-50px, -60px) scale(1.05); }
}
@keyframes float3 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-40px, 30px) scale(1.15); }
}

.landing-container {
    padding: 2.5rem 3rem;
    text-align: center;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6),
                0 0 0 1px rgba(255, 255, 255, 0.05);
    position: relative;
}

.logo-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.landing-container h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, #818cf8, #c084fc, #f472b6);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    background-size: 200% 200%;
    animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* How it works steps */
.how-it-works {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.82rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.step:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(99, 102, 241, 0.2);
}

.step-num {
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step strong {
    color: var(--text-main);
}

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

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-weight: 600;
    transition: all 0.2s ease;
    border-radius: 10px;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    padding: 0.9rem 1.2rem;
    font-size: 1rem;
    box-shadow: 0 4px 14px 0 var(--primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
}
.primary-btn:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 6px 20px 0 var(--primary-glow);
}
.primary-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}
.primary-btn:hover .btn-icon {
    transform: translateX(3px);
}

.secondary-btn {
    background: var(--glass-bg);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
}
.secondary-btn:hover { 
    background: rgba(255, 255, 255, 0.08); 
}

.danger-btn {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}
.danger-btn:hover { 
    background: rgba(239, 68, 68, 0.25); 
}

.join-box {
    display: flex;
    gap: 0.5rem;
}
.join-box input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.9rem;
    border-radius: 10px;
    text-align: center;
    font-size: 1.3rem;
    letter-spacing: 4px;
    font-weight: 600;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.join-box input::placeholder {
    letter-spacing: 1px;
    font-size: 0.9rem;
    font-weight: 400;
    color: #555;
}
.join-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.error-msg {
    color: var(--danger);
    margin-top: 0.75rem;
    font-size: 0.85rem;
    min-height: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.error-msg.visible {
    opacity: 1;
}

/* Download Section */
.download-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.download-label {
    font-size: 0.82rem;
    color: #737373;
    margin-bottom: 0.75rem;
}

.download-btn {
    display: inline-block;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    border-radius: 10px;
}

.install-hint {
    font-size: 0.72rem;
    color: #525252;
    margin-top: 0.5rem;
}

.install-hint code {
    background: rgba(0,0,0,0.3);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.7rem;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 11, 15, 0.92);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}
.spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}
@keyframes spin { 100% { transform: rotate(360deg); } }


/* Session Page */
#session-page {
    display: flex;
    flex-direction: column;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1.2rem;
    margin: 8px;
    z-index: 10;
    border-radius: 12px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.session-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.25);
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(255,255,255,0.05);
}
.session-label {
    font-size: 0.75rem;
    color: #666;
}
.session-info strong {
    color: white;
    letter-spacing: 2px;
    font-size: 0.95rem;
}
#btn-copy {
    background: rgba(99, 102, 241, 0.15);
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 6px;
    transition: all 0.2s;
}
#btn-copy:hover { 
    background: rgba(99, 102, 241, 0.25); 
    transform: none; 
}

.badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: var(--primary);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Connection Status */
.connection-status {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.connection-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.connection-status.connected {
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
}
.connection-status.connected::before {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}
.connection-status.connecting {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.connection-status.connecting::before {
    background: var(--warning);
    animation: pulse 1.5s ease-in-out infinite;
}
.connection-status.error {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.connection-status.error::before {
    background: var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.browser-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    margin: 0 8px 8px 8px;
    border-radius: 12px;
    background: #000;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    color: var(--text-muted);
    font-size: 0.95rem;
    z-index: 5;
}

#laser-pointer {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: red;
    border-radius: 50%;
    box-shadow: 0 0 10px red;
    pointer-events: none; /* Let clicks pass through */
    transform: translate(-50%, -50%);
    z-index: 100;
    transition: left 0.05s linear, top 0.05s linear;
}

/* Responsive */
@media (max-width: 500px) {
    .landing-container {
        margin: 15px;
        padding: 2rem 1.5rem;
    }

    .landing-container h1 {
        font-size: 2rem;
    }

    .join-box {
        flex-direction: column;
    }

    .how-it-works {
        gap: 0.4rem;
    }

    .step {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }

    .nav-left {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .top-nav {
        flex-direction: column;
        gap: 0.5rem;
    }
}
