/* PORTAL - Minimal Modern Design */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Display', system-ui, sans-serif;
    background: #000;
    color: var(--text-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: fixed;
}

/* ========================================
   3D WARP GATE PORTAL SYSTEM
   ======================================== */

.warp-gate-container {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    perspective: 1200px;
    perspective-origin: 50% 50%;
    pointer-events: none;
}

/* Core Portal Structure */
.warp-gate {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 800px;
    height: 800px;
    transform-style: preserve-3d;
    transform: translate(-50%, -50%) translateZ(-800px) scale(0.3);
    transition: transform 2s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 2s ease;
    opacity: 0.2;
    filter: brightness(.5) contrast(.75);
}

/* Idle State - Portal far away */
.warp-gate-container.state-idle .warp-gate {
    transform: translate(-50%, -50%) translateZ(-800px) scale(0.3);
    opacity: 0.2;
}

/* Active State - Portal comes near */
.warp-gate-container.state-active .warp-gate {
    transform: translate(-50%, -50%) translateZ(0px) scale(1);
    opacity: 1;
}

/* Connected State - Portal brighter */
.warp-gate-container.state-connected .warp-gate {
    transform: translate(-50%, -50%) translateZ(0px) scale(1);
    opacity: 1;
    filter: brightness(1) saturate(1);
}

@keyframes portalFloat {
    0%, 100% {
        transform: translateZ(0);
    }
    50% {
        transform: translateZ(20px);
    }
}

/* Black Hole Event Horizon - Properly Centered */
.portal-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
}

/* Single unified event horizon */
.ring-1 {
    width: 500px;
    height: 500px;
    transform: translate(-50%, -50%);
    background: 
        radial-gradient(circle at center, 
            #000000 0%,
            #000000 25%,
            rgba(10, 10, 20, 0.98) 35%,
            rgba(20, 30, 60, 0.7) 45%,
            rgba(59, 130, 246, 0.4) 55%,
            rgba(96, 165, 250, 0.25) 65%,
            rgba(147, 197, 253, 0.15) 75%,
            rgba(191, 219, 254, 0.08) 85%,
            transparent 100%
        );
    box-shadow: 
        0 0 120px 20px rgba(59, 130, 246, 0.5),
        0 0 200px 40px rgba(96, 165, 250, 0.3),
        inset 0 0 80px 20px rgba(0, 0, 0, 0.9);
    filter: blur(300px);
}

.ring-2,
.ring-3,
.ring-4,
.ring-5,
.ring-6 {
    display: none;
}

/* Accretion Disk Glow - Cinematic effect */
.energy-core {
    position: absolute;
    top: 45%;
    left: 50%;
    width: 500px;
    height: 500px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.core-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center,
        transparent 0%,
        transparent 20%,
        rgba(59, 130, 246, 0.15) 45%,
        rgba(96, 165, 250, 0.25) 55%,
        rgba(147, 197, 253, 0.3) 65%,
        rgba(191, 219, 254, 0.15) 75%,
        transparent 85%
    );
    border-radius: 50%;
    filter: blur(30px);
}

.core-pulse {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center,
        transparent 0%,
        transparent 15%,
        rgba(255, 255, 255, 0.1) 40%,
        rgba(147, 197, 253, 0.2) 50%,
        rgba(59, 130, 246, 0.15) 60%,
        transparent 75%
    );
    border-radius: 50%;
    filter: blur(20px);
}

/* Hex Grid - Disabled */
.hex-grid {
    display: none;
}

/* Energy Streams - Disabled */
.energy-stream {
    display: none;
}

/* Floating Dust Particles - Star Field */
.particle-field {
    position: fixed;
    inset: 0;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(200, 220, 255, 0.8) 30%,
        rgba(147, 197, 253, 0.4) 60%, 
        transparent 100%);
    box-shadow: 
        0 0 4px rgba(255, 255, 255, 0.9),
        0 0 8px rgba(147, 197, 253, 0.6);
    animation: float 12s ease-in-out infinite;
}

/* Gentle floating animation */
@keyframes float {
    0%, 100% { 
        transform: translateY(0px) translateX(0px); 
        opacity: 0.6; 
    }
    33% { 
        transform: translateY(-15px) translateX(8px); 
        opacity: 0.9; 
    }
    66% { 
        transform: translateY(-8px) translateX(-5px); 
        opacity: 1; 
    }
}

/* Realistic star sizes - varied depth */
.p1, .p2, .p3, .p4, .p5 {
    width: 2.5px;
    height: 2.5px;
}

.p6, .p7, .p8, .p9, .p10 {
    width: 2px;
    height: 2px;
}

.p11, .p12, .p13, .p14, .p15 {
    width: 1.5px;
    height: 1.5px;
    opacity: 0.8;
}

.p16, .p17, .p18, .p19, .p20 {
    width: 1.2px;
    height: 1.2px;
    opacity: 0.7;
}

.p21, .p22, .p23, .p24, .p25, .p26, .p27, .p28, .p29, .p30 {
    width: 1px;
    height: 1px;
    opacity: 0.6;
}

/* Scattered star field across entire viewport */
.p1 { left: 15%; top: 20%; animation-delay: 0s; animation-duration: 14s; }
.p2 { left: 85%; top: 15%; animation-delay: -2s; animation-duration: 11s; }
.p3 { left: 45%; top: 10%; animation-delay: -4s; animation-duration: 13s; }
.p4 { left: 70%; top: 85%; animation-delay: -6s; animation-duration: 15s; }
.p5 { left: 25%; top: 75%; animation-delay: -3s; animation-duration: 12s; }
.p6 { left: 90%; top: 45%; animation-delay: -5s; animation-duration: 14s; }
.p7 { left: 10%; top: 55%; animation-delay: -1s; animation-duration: 11s; }
.p8 { left: 78%; top: 65%; animation-delay: -7s; animation-duration: 13s; }
.p9 { left: 35%; top: 88%; animation-delay: -8s; animation-duration: 15s; }
.p10 { left: 60%; top: 25%; animation-delay: -3.6s; animation-duration: 12s; }
.p11 { left: 20%; top: 40%; animation-delay: -4.4s; animation-duration: 14s; }
.p12 { left: 82%; top: 78%; animation-delay: -6.4s; animation-duration: 11s; }
.p13 { left: 65%; top: 12%; animation-delay: -1.6s; animation-duration: 13s; }
.p14 { left: 42%; top: 68%; animation-delay: -5.6s; animation-duration: 15s; }
.p15 { left: 12%; top: 82%; animation-delay: -2.4s; animation-duration: 12s; }
.p16 { left: 55%; top: 35%; animation-delay: -7.6s; animation-duration: 14s; }
.p17 { left: 88%; top: 28%; animation-delay: -2.8s; animation-duration: 11s; }
.p18 { left: 32%; top: 52%; animation-delay: -4.8s; animation-duration: 13s; }
.p19 { left: 75%; top: 92%; animation-delay: -0.6s; animation-duration: 15s; }
.p20 { left: 18%; top: 18%; animation-delay: -6.6s; animation-duration: 12s; }
.p21 { left: 48%; top: 42%; animation-delay: -3.8s; animation-duration: 14s; }
.p22 { left: 92%; top: 60%; animation-delay: -5.8s; animation-duration: 11s; }
.p23 { left: 28%; top: 30%; animation-delay: -1.2s; animation-duration: 13s; }
.p24 { left: 68%; top: 48%; animation-delay: -7.2s; animation-duration: 15s; }
.p25 { left: 8%; top: 72%; animation-delay: -2.6s; animation-duration: 12s; }
.p26 { left: 52%; top: 8%; animation-delay: -4.6s; animation-duration: 14s; }
.p27 { left: 72%; top: 72%; animation-delay: -1.8s; animation-duration: 11s; }
.p28 { left: 38%; top: 22%; animation-delay: -7.8s; animation-duration: 13s; }
.p29 { left: 95%; top: 38%; animation-delay: -3.2s; animation-duration: 15s; }
.p30 { left: 5%; top: 95%; animation-delay: -5.2s; animation-duration: 12s; }

/* Radial Gradient Overlays - Disabled */
.radial-overlay {
    display: none;
}

/* ========================================
   WARP GATE STATES (Connection Feedback)
   ======================================== */

/* Connected State - Intensify black hole when peer connected */
.warp-gate-container.state-connected .ring-1 {
    box-shadow: 
        0 0 150px 30px rgba(59, 130, 246, 0.7),
        0 0 250px 50px rgba(96, 165, 250, 0.4),
        inset 0 0 80px 20px rgba(0, 0, 0, 0.9) !important;
}

.warp-gate-container.state-connected .core-glow {
    background: radial-gradient(circle at center,
        transparent 0%,
        transparent 20%,
        rgba(59, 130, 246, 0.3) 45%,
        rgba(96, 165, 250, 0.4) 55%,
        rgba(147, 197, 253, 0.45) 65%,
        rgba(191, 219, 254, 0.25) 75%,
        transparent 85%
    );
    filter: blur(35px);
}

.warp-gate-container.state-connected .particle {
    box-shadow: 
        0 0 6px rgba(255, 255, 255, 1),
        0 0 12px rgba(147, 197, 253, 0.9) !important;
}

/* Mode Selection */
.mode-selection {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    gap: 80px;
}

.mode-selection.active {
    display: flex;
}

.logo-container {
    text-align: center;
    position: relative;
}

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.1); }
}

.logo-title {
    font-size: 72px;
    font-weight: 700;
    letter-spacing: 8px;
    background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.mode-options {
    display: flex;
    gap: 50px;
    align-items: center;
}

.mode-btn {
    position: relative;
    width: 200px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 50px;
    gap: 15px;
}

.mode-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
}

.mode-icon {
    color: var(--primary);
}

.mode-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Device Name */
.device-name-container {
    margin-top: 40px;
}

.device-name-input {
    padding: 10px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 200px;
    text-align: center;
    font-family: inherit;
    outline: none;
}

.device-name-input::placeholder {
    color: var(--text-secondary);
}

.device-name-input:hover {
    border-color: var(--primary);
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.05);
}

.device-name-input:focus {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
    color: var(--text-primary);
}

/* Portal View */
.portal-view {
    position: fixed;
    inset: 0;
    z-index: 50;
}

/* Scanner View */
.scanner-view {
    position: absolute;
    inset: 0;
    background: #000;
    display: none;
}

.scanner-view.active {
    display: block;
}

#video {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 100%;
    min-height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scan-frame {
    width: 300px;
    height: 300px;
    position: relative;
}

.corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid var(--primary);
}

.corner-tl { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 4px 0 0 0; }
.corner-tr { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 4px 0 0; }
.corner-bl { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 4px; }
.corner-br { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 4px 0; }

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    box-shadow: 0 0 20px var(--primary);
    animation: scan 2s ease-in-out infinite;
}

@keyframes scan {
    0%, 100% { transform: translateY(0); opacity: 0; }
    50% { transform: translateY(300px); opacity: 1; }
}

.back-btn {
    position: absolute;
    top: 30px;
    left: 30px;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: var(--primary);
}

.qr-status {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.qr-status.detected {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.qr-status-text {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* QR Host View */
.qr-host-view {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
}

.qr-host-view.active {
    display: flex;
}

.qr-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.qr-wrapper {
    position: relative;
}

.qr-glow {
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.4) 0%, transparent 70%);
    filter: blur(30px);
    z-index: -1;
}

.qr-code {
    padding: 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.qr-actions {
    display: flex;
    gap: 16px;
}

.btn-icon-large {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon-large:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary);
}

.connection-badge {
    position: absolute;
    top: -80px;
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: rgba(59, 130, 246, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid var(--primary);
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.connection-badge.active {
    display: flex;
}

.connection-badge:hover {
    background: rgba(59, 130, 246, 0.2);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.pulse-dot {
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Send Interface */
.send-interface {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.send-interface.active {
    display: flex;
}

.send-container {
    width: 100%;
    max-width: 600px;
    background: var(--glass-bg);
    backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.send-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
}

.send-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

.connected-device-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.send-content {
    padding: 24px;
}

#messageField {
    width: 100%;
    min-height: 180px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
}

#messageField::placeholder {
    color: var(--text-secondary);
}

#messageField:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: rgba(0, 0, 0, 0.4);
}

.send-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--glass-border);
}

.send-actions {
    display: flex;
    gap: 12px;
}

.btn-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-primary {
    flex: 1;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 14px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

/* Reception Area */
.reception-area {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 400px;
    z-index: 200;
}

.reception-toast {
    background: var(--glass-bg);
    backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    animation: slideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.reception-toast:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
}

.reception-toast.receiving {
    border-color: var(--primary);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.reception-toast.complete {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

.reception-toast.complete:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary);
}

.toast-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    color: var(--primary);
}

.toast-icon svg {
    flex-shrink: 0;
}

.toast-info {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toast-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.toast-preview {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-top: 12px;
    max-height: 60px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.toast-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 12px;
    margin-top: 12px;
}

/* Progress Indicator */
.progress-container {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    border-radius: 20px;
    transition: width 0.3s ease;
    position: relative;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShine 1.5s ease-in-out infinite;
}

@keyframes progressShine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    min-width: 42px;
    text-align: right;
}

.complete .progress-fill {
    background: var(--primary);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.complete .progress-text {
    color: var(--primary);
}

/* Toast Container */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    pointer-events: none;
    text-align: center;
}

.notification-toast {
    padding: 16px 28px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .logo-title {
        font-size: 56px;
    }

    .mode-options {
        gap: 60px;
    }
    
    .send-container {
        max-width: 100%;
        border-radius: 20px;
    }

    .reception-area {
        right: 16px;
        bottom: 16px;
        left: 16px;
        max-width: none;
    }

    .scan-frame {
        width: 260px;
        height: 260px;
    }

    .back-btn {
        top: 20px;
        left: 20px;
    }
}

@media (max-width: 480px) {
    .logo-title {
        font-size: 48px;
    }

    .mode-options {
        flex-direction: column;
        gap: 20px;
    }

    .mode-label {
        font-size: 16px;
    }

    #messageField {
        min-height: 120px;
    }
}

/* ========================================
   VERSION FOOTER
   ======================================== */

.version-footer {
    position: fixed;
    bottom: 16px;
    left: 16px;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.3);
    z-index: 1000;
    font-family: 'SF Mono', 'Courier New', monospace;
    letter-spacing: 0.5px;
    pointer-events: none;
    user-select: none;
    transition: color 0.3s ease;
}

.version-footer:hover {
    color: rgba(255, 255, 255, 0.5);
}

/* ========================================
   INSTALL PROMPT
   ======================================== */

.install-prompt {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    z-index: 500;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.install-prompt.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: all;
}

.install-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    max-width: 500px;
}

.install-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 12px;
    color: var(--primary);
    flex-shrink: 0;
}

.install-text {
    flex: 1;
    min-width: 0;
}

.install-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.install-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.install-btn {
    padding: 10px 20px;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.install-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.install-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.install-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

@media (max-width: 640px) {
    .install-content {
        max-width: calc(100vw - 40px);
        padding: 14px 18px;
        gap: 12px;
    }

    .install-icon {
        width: 36px;
        height: 36px;
    }

    .install-title {
        font-size: 14px;
    }

    .install-subtitle {
        font-size: 12px;
    }

    .install-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .install-close {
        width: 28px;
        height: 28px;
    }
}

/* ========================================
   PEERS MODAL (Host → Peer bidirectional)
   ======================================== */

.peers-modal {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.peers-modal.open {
    opacity: 1;
    pointer-events: all;
}

.peers-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.peers-modal-content {
    position: relative;
    width: 100%;
    max-width: 520px;
    background: rgba(10, 10, 20, 0.95);
    backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(59, 130, 246, 0.1);
    overflow: hidden;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.peers-modal.open .peers-modal-content {
    transform: translateY(0) scale(1);
}

.peers-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
}

.peers-modal-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.peers-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.peers-list {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
}

.peers-list::-webkit-scrollbar {
    width: 4px;
}

.peers-list::-webkit-scrollbar-track {
    background: transparent;
}

.peers-list::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 4px;
}

/* Individual peer row */
.peer-row {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.peer-row:hover {
    border-color: rgba(59, 130, 246, 0.3);
}

.peer-row-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    gap: 12px;
}

.peer-name-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.peer-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.peer-row-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.peer-action-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.peer-action-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

.peer-action-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

/* Expandable text area for peer messaging */
.peer-text-expand {
    border-top: 1px solid var(--glass-border);
    padding: 16px 18px;
    display: none;
    flex-direction: column;
    gap: 10px;
}

.peer-text-expand.visible {
    display: flex;
}

.peer-message-field {
    width: 100%;
    min-height: 90px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
}

.peer-message-field::placeholder {
    color: var(--text-secondary);
}

.peer-message-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: rgba(0, 0, 0, 0.4);
}

.peer-send-row {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.peer-send-btn {
    height: 42px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.peer-send-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

/* Empty state */
.peers-empty {
    padding: 40px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

@media (max-width: 560px) {
    .peers-modal {
        padding: 16px;
        align-items: flex-end;
    }

    .peers-modal-content {
        border-radius: 20px 20px 16px 16px;
        max-width: 100%;
    }

    .peers-list {
        max-height: 50vh;
    }
}

/* ========================================
   SELECT MODE (multi-peer)
   ======================================== */

/* Fixed row height so entering/exiting select mode never causes a jump */
.peer-row-main {
    min-height: 74px;
}

/* Peer checkbox — hidden by default */
.peer-checkbox {
    display: none;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    color: transparent;
    background: rgba(255, 255, 255, 0.04);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

/* Show checkbox when select mode is active */
.peers-modal.select-mode .peer-checkbox {
    display: flex;
}

/* Selected peer checkbox */
.peer-row.selected .peer-checkbox {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Selected peer row highlight */
.peer-row.selected {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.07);
}

/* In select mode, peer row main is clickable */
.peers-modal.select-mode .peer-row-main {
    cursor: pointer;
    user-select: none;
}

/* In select mode, hide per-row action buttons */
.peers-modal.select-mode .peer-row-actions {
    display: none;
}

/* In select mode, collapse any open text areas */
.peers-modal.select-mode .peer-text-expand {
    display: none !important;
}

/* Prevent text selection during long press */
.peers-modal .peer-row {
    -webkit-touch-callout: none;
    user-select: none;
}

/* Select mode compose area */
.peers-select-compose {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 0 16px 12px;
}

.peers-select-compose.visible {
    display: flex;
}

/* Select mode toolbar */
.peers-select-toolbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-top: 1px solid var(--glass-border);
}

.peers-modal.select-mode .peers-select-toolbar {
    display: flex;
}

.select-toolbar-left,
.select-toolbar-right {
    display: flex;
    gap: 8px;
}

/* Active state for select text button */
#selectSendText.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

/* Hide select all when all peers are already selected */
#selectAll.hidden {
    display: none;
}
