:root {
    --bg-dark: #05070a;
    --card-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #a855f7;
    --secondary-glow: rgba(168, 85, 247, 0.4);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --danger: #ef4444;
    --success: #10b981;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

#app {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

/* Animated Blobs */
.blob {
    position: fixed;
    width: 500px;
    height: 500px;
    filter: blur(80px);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.15;
    animation: pulse 20s infinite alternate;
}

.blob-1 {
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.blob-2 {
    background: var(--secondary);
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes pulse {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.2) translate(50px, 50px); }
}

header {
    padding: 2rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--text-dim) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-tag .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-tag.waiting .dot { background: var(--secondary); box-shadow: 0 0 10px var(--secondary); }
.status-tag.connected .dot { background: var(--success); box-shadow: 0 0 10px var(--success); }
.status-tag.disconnected .dot { background: var(--danger); }

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 5%;
}

.view {
    width: 100%;
    max-width: 600px;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.main-card h2 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.main-card p {
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

.action-area {
    margin-bottom: 2rem;
}

.btn {
    position: relative;
    padding: 1rem 2rem;
    border-radius: 12px;
    border: none;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.btn.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px var(--primary-glow);
}

.btn.secondary {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

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

.btn.danger {
    background: var(--danger);
    color: white;
}

.btn.small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn.pulse {
    animation: btnPulse 2s infinite;
}

@keyframes btnPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 var(--primary-glow); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 20px rgba(99, 102, 241, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.link-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    text-align: left;
}

.link-box label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-main);
    font-family: monospace;
    font-size: 0.9rem;
}

.hint {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--secondary);
    font-weight: 500;
}

.video-container {
    width: 100%;
    max-width: 1000px;
    padding: 0.75rem;
    position: relative;
    overflow: hidden;
}

#remote-video {
    width: 100%;
    border-radius: 16px;
    background: #000;
    display: block;
}

.video-overlay {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.peer-id-badge {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.safety-box {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    text-align: left;
}

.safety-box p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-dim);
}

footer {
    padding: 2rem;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-main);
    color: var(--bg-dark);
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
}

.hidden {
    display: none !important;
}

@media (max-width: 640px) {
    .glass-card { padding: 2rem; }
    .main-card h2 { font-size: 1.75rem; }
    .input-group { flex-direction: column; }
}
