:root {
    --bg-color: #050505;
    /* Deep rich black */
    --text-main: #ffffff;
    --text-secondary: #a0a0b0;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-hover: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    --danger-color: #ff4b4b;
    --card-bg: rgba(20, 20, 20, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-family: 'Montserrat', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    color: var(--text-main);
    overflow-y: auto;
    /* Allow potential scrolling on body if needed */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    /* Add padding for scroll space */
}

/* Background Animation */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 10s infinite ease-in-out;
}

.globe-1 {
    width: 400px;
    height: 400px;
    background: #764ba2;
    top: -50px;
    left: -100px;
    animation-delay: 0s;
}

.globe-2 {
    width: 300px;
    height: 300px;
    background: #667eea;
    bottom: -50px;
    right: -50px;
    animation-delay: 2s;
}

.globe-3 {
    width: 200px;
    height: 200px;
    background: #ff758c;
    top: 40%;
    left: 40%;
    animation-delay: 4s;
    opacity: 0.4;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(20px, -20px);
    }
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 480px;
    height: auto;
    /* Allow auto height */
    min-height: 90vh;
    /* Minimum height */
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
}

@media (max-width: 500px) {
    .app-container {
        max-height: 100%;
        border-radius: 0;
        border: none;
    }
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.highlight {
    color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.connection-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #555;
    transition: background-color 0.3s;
}

.status-dot.active {
    background-color: #00ff88;
    box-shadow: 0 0 10px #00ff88;
}

/* Main Content Views */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
}

.view {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.4s ease;
}

.view.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Intro View */
#intro-view h1 {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 16px;
    font-weight: 800;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 32px;
}

.features {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.feature-item {
    background: rgba(255, 255, 255, 0.08);
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

/* Searching View */
.pulse-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pulse-avatar {
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    position: relative;
    z-index: 2;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(102, 126, 234, 0.5);
    animation: pulse 2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

.pulse-ring:nth-child(2) {
    animation-delay: 0.5s;
}

@keyframes pulse {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Chat View */
.visualizer-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#audio-visualizer {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    opacity: 0.5;
}

.avatar-circles {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 20px;
}

.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #2a2a35;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.avatar.user {
    background: linear-gradient(135deg, #434343 0%, #000000 100%);
    border-color: #667eea;
}

.avatar.peer {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    border-color: #fff;
    color: #fff;
    font-size: 1.5rem;
    position: relative;
    transition: all 0.3s ease;
}

.avatar.peer.muted::after {
    content: '🔇';
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #333;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #2a2a35;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

.connection-line {
    width: 40px;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    position: relative;
}

.chat-status {
    margin-top: 16px;
    font-size: 0.9rem;
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
    padding: 6px 16px;
    border-radius: 20px;
}

.user-info-badge {
    position: absolute;
    top: -40px;
    /* Position above avatar circles */
    background: rgba(0, 0, 0, 0.6);
    color: #a0a0b0;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

/* Controls */
.app-controls {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 16px;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    outline: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 10px 20px rgba(118, 75, 162, 0.4);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 15px 30px rgba(118, 75, 162, 0.6);
}

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: rgba(255, 75, 75, 0.15);
    color: #ff8888;
    border: 1px solid rgba(255, 75, 75, 0.3);
}

.btn-danger:hover {
    background: rgba(255, 75, 75, 0.25);
    color: #ff4b4b;
}

.chat-controls {
    display: flex;
    gap: 12px;
    width: 100%;
}

.chat-controls .btn {
    flex: 1;
    min-width: 0;
    /* Prevent overflow on small screens */
    padding: 18px 10px;
    /* SLightly tighter padding */
}

.chat-controls .btn-icon-only {
    flex: 0 0 60px;
    /* Fixed width for icon button */
    font-size: 1.2rem;
}

.hidden {
    display: none !important;
}

.icon {
    font-size: 1.2rem;
}

/* Filters */
.filters-container {
    width: 100%;
    margin-top: 20px;
    background: rgba(0, 0, 0, 0.3);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    flex: 1;
}

.filter-col.full-width {
    width: 100%;
    flex: none;
}

.filter-col label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    margin-left: 4px;
}

.toggle-group {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 3px;
    width: 100%;
}

.toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 0;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.toggle-btn.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.filter-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    /* simple styling */
}

.filter-select:focus {
    border-color: #667eea;
}

.filter-select option {
    background: #1a1a2e;
    color: white;
}

.filter-divider {
    border: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 12px 0;
}

/* Timer */
/* Timer */
.call-timer {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
    letter-spacing: 1px;
}