/* Nature-Themed Video Calling Platform */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Nature color palette */
    --forest-dark: #1B4332;
    --forest-green: #2D6A4F;
    --leaf-green: #40916C;
    --sage: #52B788;
    --light-sage: #74C69D;
    --mint: #95D5B2;
    --light-mint: #B7E4C7;
    --cream: #D8F3DC;
    
    /* Wood tones */
    --wood-dark: #5D4037;
    --wood-medium: #795548;
    --wood-light: #A1887F;
    --wood-lighter: #BCAAA4;
    
    /* Additional colors */
    --sky-blue: #B3D9FF;
    --gold: #FFD54F;
    --white: #FFFFFF;
    --shadow: rgba(0, 0, 0, 0.2);
    --shadow-strong: rgba(0, 0, 0, 0.4);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1B4332 0%, #2D6A4F 50%, #40916C 100%);
    min-height: 100vh;
    color: var(--white);
    position: relative;
    overflow-x: hidden;
}

/* Animated background with nature pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(116, 198, 157, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(82, 183, 136, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(64, 145, 108, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.03) 2px,
            rgba(255, 255, 255, 0.03) 4px
        );
    pointer-events: none;
    z-index: 1;
}

/* Wood texture effect */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-md);
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header styles */
.header {
    text-align: center;
    padding: var(--spacing-lg) 0;
    background: linear-gradient(135deg, var(--wood-dark), var(--wood-medium));
    border-radius: 20px;
    box-shadow: 0 8px 32px var(--shadow-strong);
    margin-bottom: var(--spacing-lg);
    position: relative;
    overflow: hidden;
}

/* Wood grain texture */
.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.1) 2px,
            rgba(0, 0, 0, 0.1) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 1px,
            rgba(0, 0, 0, 0.05) 1px,
            rgba(0, 0, 0, 0.05) 2px
        );
    opacity: 0.6;
    pointer-events: none;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
    position: relative;
    z-index: 1;
}

.logo-icon {
    filter: drop-shadow(0 2px 8px var(--shadow));
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--cream);
    text-shadow: 2px 2px 4px var(--shadow-strong);
    letter-spacing: 2px;
    position: relative;
    z-index: 1;
}

.header-toolbar {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    z-index: 2;
}

.lang-select-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.lang-select {
    appearance: none;
    padding: 0.4rem 1.75rem 0.4rem 0.65rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cream);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%23d8f3dc'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
}

.lang-select:hover {
    border-color: var(--gold);
    background-color: rgba(0, 0, 0, 0.45);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 520px) {
    .header-toolbar {
        position: relative;
        top: auto;
        right: auto;
        display: flex;
        justify-content: center;
        margin-bottom: var(--spacing-sm);
    }
}

.tagline {
    font-size: 1rem;
    color: var(--light-mint);
    font-style: italic;
    position: relative;
    z-index: 1;
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md) 0;
}

.screen {
    display: none;
    width: 100%;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Welcome card */
.welcome-card {
    background: linear-gradient(135deg, rgba(64, 145, 108, 0.9), rgba(45, 106, 79, 0.9));
    backdrop-filter: blur(10px);
    padding: var(--spacing-xl);
    border-radius: 24px;
    box-shadow: 0 16px 48px var(--shadow-strong);
    max-width: 500px;
    width: 100%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

/* Wood texture on card */
.welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(93, 64, 55, 0.1) 10px,
            rgba(93, 64, 55, 0.1) 20px
        );
    pointer-events: none;
}

.welcome-card h2 {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
    color: var(--cream);
    text-align: center;
    position: relative;
}

.welcome-card p {
    text-align: center;
    color: var(--light-mint);
    margin-bottom: var(--spacing-lg);
    position: relative;
}

.input-group {
    margin-bottom: var(--spacing-md);
    position: relative;
}

.input-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    color: var(--cream);
    font-weight: 500;
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--wood-light);
    border-radius: 12px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.95);
    color: var(--forest-dark);
    transition: all 0.3s ease;
    position: relative;
}

.input-group input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(255, 213, 79, 0.2);
    transform: translateY(-2px);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 14px;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    position: relative;
}

.btn-primary {
    background: linear-gradient(145deg, #ffe082 0%, var(--gold) 45%, #f9a825 100%);
    color: var(--forest-dark);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.18),
        0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow:
        0 4px 14px rgba(255, 193, 7, 0.35),
        0 1px 0 rgba(255, 255, 255, 0.4) inset;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-icon {
    filter: drop-shadow(0 1px 2px var(--shadow));
}

/* Call screen */
#call-screen {
    flex-direction: column;
    max-width: 100%;
    width: 100%;
}

.call-layout {
    display: flex;
    gap: var(--spacing-md);
    align-items: stretch;
    width: 100%;
}

.call-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Side chat */
.chat-panel {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: rgba(27, 67, 50, 0.92);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 20px var(--shadow);
    overflow: hidden;
    max-height: min(72vh, 640px);
}

.chat-panel-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: 600;
    color: var(--gold);
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.chat-title {
    font-size: 1rem;
}

.chat-panel-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--cream);
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.chat-panel-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 213, 79, 0.35);
}

.chat-panel-toggle .chat-chevron {
    transition: transform 0.2s ease;
}

.chat-panel.chat-open .chat-panel-toggle .chat-chevron {
    transform: rotate(180deg);
}

.chat-fab {
    display: none;
    align-items: center;
    gap: 0.35rem;
    position: fixed;
    z-index: 90;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    padding: 0.45rem 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: linear-gradient(160deg, rgba(64, 145, 108, 0.95), rgba(27, 67, 50, 0.98));
    color: var(--cream);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    box-shadow:
        0 3px 14px rgba(0, 0, 0, 0.35),
        0 1px 0 rgba(255, 255, 255, 0.12) inset;
    touch-action: manipulation;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-fab:hover {
    transform: translateY(-1px);
    box-shadow:
        0 5px 18px rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(255, 255, 255, 0.15) inset;
}

.chat-fab:active {
    transform: translateY(0);
}

.chat-fab svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    opacity: 0.92;
}

.call-layout:has(.chat-panel.chat-open) .chat-fab {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    min-height: 120px;
    font-size: 0.85rem;
}

.chat-msg {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--cream);
    word-break: break-word;
}

.chat-msg .chat-msg-user {
    font-weight: 600;
    color: var(--light-sage);
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.chat-input-row {
    display: flex;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    padding-bottom: max(var(--spacing-sm), env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: rgba(255, 255, 255, 0.95);
    color: var(--forest-dark);
    font-size: 0.9rem;
}

.chat-input:focus {
    outline: 2px solid var(--gold);
    outline-offset: 1px;
}

.chat-send {
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(180, 120, 0, 0.35);
    background: linear-gradient(145deg, #ffe082 0%, var(--gold) 50%, #f9a825 100%);
    color: var(--forest-dark);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.12),
        0 1px 0 rgba(255, 255, 255, 0.35) inset;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-send:hover {
    transform: translateY(-1px);
    box-shadow:
        0 3px 12px rgba(255, 193, 7, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.4) inset;
}

.chat-send:active {
    transform: translateY(0);
}

/* Desktop: чат как аккуратная боковая колонка */
@media (min-width: 769px) {
    .call-layout {
        align-items: stretch;
        min-height: min(78vh, 820px);
    }

    .chat-panel {
        width: min(360px, 32vw);
        min-width: 300px;
        max-height: none;
        align-self: stretch;
        display: flex;
        flex-direction: column;
        border-radius: 20px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        background: linear-gradient(
            165deg,
            rgba(27, 67, 50, 0.94) 0%,
            rgba(15, 45, 35, 0.96) 100%
        );
        box-shadow:
            0 12px 40px rgba(0, 0, 0, 0.35),
            inset 0 1px 0 rgba(255, 255, 255, 0.12);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
    }

    .chat-header {
        padding: var(--spacing-md) var(--spacing-md);
        background: linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.35) 0%,
            rgba(0, 0, 0, 0.12) 100%
        );
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .chat-title {
        font-size: 1.05rem;
        letter-spacing: 0.02em;
    }

    .chat-messages {
        padding: var(--spacing-md);
        gap: var(--spacing-sm);
        font-size: 0.9rem;
        line-height: 1.45;
        background: rgba(0, 0, 0, 0.14);
    }

    .chat-msg {
        padding: var(--spacing-sm) var(--spacing-md);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    }

    .chat-msg .chat-msg-user {
        font-size: 0.82rem;
        margin-bottom: 4px;
        color: var(--mint);
    }

    .chat-input-row {
        padding: var(--spacing-md);
        padding-bottom: var(--spacing-md);
        background: rgba(0, 0, 0, 0.22);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .chat-input {
        border-radius: 12px;
        padding: 10px 14px;
        font-size: 0.95rem;
    }

    .chat-send {
        padding: 0.45rem 1rem;
        font-size: 0.8rem;
        min-width: 76px;
    }
}

.remote-audio {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.control-btn.active .icon-noise .noise-strike {
    display: none;
}

.call-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(45, 106, 79, 0.8);
    backdrop-filter: blur(10px);
    padding: var(--spacing-md);
    border-radius: 16px;
    margin-bottom: var(--spacing-md);
    box-shadow: 0 4px 16px var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.room-indicator,
.participants-count {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--cream);
    font-weight: 500;
}

.room-icon,
.participants-icon {
    color: var(--gold);
}

.participants-panel {
    background: rgba(45, 106, 79, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 14px;
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 16px var(--shadow);
}

.participants-panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gold);
    margin-bottom: var(--spacing-sm);
}

.participants-hint {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--light-mint);
    opacity: 0.85;
}

.participants-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    max-height: min(220px, 35vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.participant-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.85rem;
    color: var(--cream);
}

.participant-row:last-child {
    border-bottom: none;
}

.participant-row.is-self {
    background: rgba(0, 0, 0, 0.12);
    margin: 0 calc(-1 * var(--spacing-sm));
    padding-left: var(--spacing-sm);
    padding-right: var(--spacing-sm);
    border-radius: 8px;
    border-bottom: none;
}

.participant-name {
    flex: 1;
    min-width: 100px;
    word-break: break-word;
}

.participant-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-end;
}

.participant-btn {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.11) 0%,
        rgba(0, 0, 0, 0.18) 100%
    );
    color: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    touch-action: manipulation;
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.2),
        0 1px 0 rgba(255, 255, 255, 0.08) inset;
    transition:
        transform 0.12s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease;
}

.participant-btn:hover {
    border-color: rgba(255, 213, 79, 0.4);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.16) 0%,
        rgba(0, 0, 0, 0.12) 100%
    );
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.22),
        0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

.participant-btn:active {
    transform: scale(0.96);
}

.participant-btn.warn {
    border-color: rgba(255, 213, 79, 0.55);
    color: #fff8e1;
    background: linear-gradient(
        180deg,
        rgba(255, 213, 79, 0.22) 0%,
        rgba(100, 70, 0, 0.25) 100%
    );
}

.participant-btn.danger {
    border-color: rgba(239, 83, 80, 0.6);
    color: #ffebee;
    background: linear-gradient(
        180deg,
        rgba(211, 47, 47, 0.35) 0%,
        rgba(80, 20, 20, 0.4) 100%
    );
}

.participant-btn.danger:hover {
    border-color: rgba(255, 138, 128, 0.75);
}

/* Video container */
.video-container {
    position: relative;
    width: 100%;
    min-height: 500px;
    background: linear-gradient(135deg, rgba(27, 67, 50, 0.9), rgba(45, 106, 79, 0.9));
    border-radius: 24px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: 0 8px 32px var(--shadow-strong);
    border: 2px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.remote-videos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.remote-video-wrapper {
    position: relative;
    background: var(--forest-dark);
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 16/9;
    box-shadow: 0 4px 16px var(--shadow);
    border: 2px solid var(--wood-light);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.remote-video-wrapper.video-focused {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold), 0 8px 28px var(--shadow-strong);
}

.video-container.video-focus-active.video-focus-remote .remote-videos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: var(--spacing-xs);
    align-items: start;
    margin-bottom: var(--spacing-sm);
}

.video-container.video-focus-active.video-focus-remote .remote-video-wrapper.video-focused {
    grid-column: 1 / -1;
    min-height: min(50vh, 520px);
    aspect-ratio: 16/9;
    max-height: none;
}

.video-container.video-focus-active.video-focus-remote .remote-video-wrapper:not(.video-focused) {
    aspect-ratio: 16/9;
    max-height: 108px;
    min-height: 0;
}

.video-container.video-focus-active.video-focus-local {
    display: flex;
    flex-direction: column;
}

.video-container.video-focus-active.video-focus-local .local-video-wrapper.video-focused {
    position: relative;
    bottom: auto;
    right: auto;
    width: 100%;
    max-width: 100%;
    margin-bottom: var(--spacing-sm);
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold), 0 8px 24px var(--shadow-strong);
}

.video-container.video-focus-active.video-focus-local .remote-videos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--spacing-xs);
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 0;
}

.video-container.video-focus-active.video-focus-local .remote-video-wrapper {
    max-height: 160px;
}

.remote-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.remote-video-label {
    position: absolute;
    bottom: var(--spacing-sm);
    left: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.local-video-wrapper {
    position: absolute;
    bottom: var(--spacing-md);
    right: var(--spacing-md);
    width: 240px;
    aspect-ratio: 16/9;
    background: var(--forest-dark);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px var(--shadow-strong);
    border: 3px solid var(--wood-medium);
    z-index: 10;
}

.local-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.local-video-label {
    position: absolute;
    bottom: var(--spacing-xs);
    left: var(--spacing-xs);
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Call controls */
.call-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: linear-gradient(
        145deg,
        rgba(93, 64, 55, 0.92) 0%,
        rgba(62, 39, 35, 0.95) 100%
    );
    padding: 0.65rem 0.75rem;
    border-radius: 18px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.28),
        0 1px 0 rgba(255, 255, 255, 0.08) inset;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0.45rem 0.55rem;
    min-width: 4.25rem;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    color: var(--cream);
    cursor: pointer;
    transition:
        transform 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 213, 79, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn.active {
    background: rgba(255, 213, 79, 0.18);
    border-color: rgba(255, 213, 79, 0.55);
    color: var(--gold);
    box-shadow:
        0 0 0 1px rgba(255, 213, 79, 0.25),
        0 2px 8px rgba(0, 0, 0, 0.2);
}

.control-btn.end-call {
    background: rgba(211, 47, 47, 0.2);
    border-color: rgba(229, 115, 115, 0.45);
    color: #ffcdd2;
}

.control-btn.end-call:hover {
    background: rgba(211, 47, 47, 0.38);
    border-color: rgba(255, 138, 128, 0.65);
}

.control-btn svg {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
    opacity: 0.95;
}

/* Footer */
.footer {
    text-align: center;
    padding: var(--spacing-md) 0;
    color: var(--light-mint);
    font-size: 0.9rem;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: var(--spacing-md);
    right: var(--spacing-md);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    background: linear-gradient(135deg, var(--forest-green), var(--forest-dark));
    color: var(--white);
    padding: var(--spacing-md);
    border-radius: 12px;
    box-shadow: 0 4px 16px var(--shadow-strong);
    border: 1px solid var(--gold);
    min-width: 300px;
    animation: slideIn 0.3s ease-out, slideOut 0.3s ease-in 2.7s;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.toast.error {
    background: linear-gradient(135deg, #C62828, #B71C1C);
}

.toast.success {
    background: linear-gradient(135deg, var(--leaf-green), var(--forest-green));
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .welcome-card {
        padding: var(--spacing-lg);
    }

    .call-layout {
        display: block;
        position: relative;
    }

    .call-main {
        min-height: 0;
    }

    .video-container {
        min-height: 280px;
    }

    .chat-fab {
        display: inline-flex;
        bottom: max(76px, calc(8px + env(safe-area-inset-bottom)));
        right: max(12px, env(safe-area-inset-right));
    }

    .chat-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: min(56vh, 480px);
        border-radius: 16px 16px 0 0;
        z-index: 100;
        max-width: 100vw;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
        transform: translateY(calc(100% - 52px));
        transition: transform 0.28s ease;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .chat-panel.chat-open {
        transform: translateY(0);
    }

    .chat-panel-toggle {
        display: flex;
    }

    .chat-header {
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .chat-messages {
        min-height: 100px;
    }

    .chat-input {
        font-size: 16px;
    }
    
    .local-video-wrapper {
        width: 150px;
        bottom: var(--spacing-sm);
        right: var(--spacing-sm);
    }
    
    .call-controls {
        gap: 0.4rem;
        padding: 0.55rem 0.5rem;
    }
    
    .control-btn {
        min-width: 3.75rem;
        padding: 0.4rem 0.45rem;
        font-size: 0.62rem;
    }

    .control-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .remote-videos {
        grid-template-columns: 1fr;
    }
    
    .toast-container {
        left: var(--spacing-sm);
        right: var(--spacing-sm);
    }
    
    .toast {
        min-width: auto;
    }
}

/* Video placeholder when no stream */
.video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--forest-dark), var(--forest-green));
    color: var(--light-mint);
}

.video-placeholder svg {
    width: 64px;
    height: 64px;
    margin-bottom: var(--spacing-sm);
    opacity: 0.5;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

