body {
    background: #ECEFF1;
    color: rgba(0, 0, 0, 0.87);
    font-family: Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
}

#message {
    background: white;
    max-width: 360px;
    margin: 100px auto 16px;
    padding: 32px 24px;
    border-radius: 3px;
}

#message h2 {
    color: #ffa100;
    font-weight: bold;
    font-size: 16px;
    margin: 0 0 8px;
}

#message h1 {
    font-size: 22px;
    font-weight: 300;
    color: rgba(0, 0, 0, 0.6);
    margin: 0 0 16px;
}

#message p {
    line-height: 140%;
    margin: 16px 0 24px;
    font-size: 14px;
}

#message a {
    display: block;
    text-align: center;
    background: #039be5;
    text-transform: uppercase;
    text-decoration: none;
    color: white;
    padding: 16px;
    border-radius: 4px;
}

#message, #message a {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

#load {
    color: rgba(0, 0, 0, 0.4);
    text-align: center;
    font-size: 13px;
}

@media (max-width: 600px) {
    body, #message {
        margin-top: 0;
        background: white;
        box-shadow: none;
    }

    body {
        border-top: 16px solid #ffa100;
    }
}

body {
    margin: 1em;
    padding: 0 0.5em;
}

/* Reset any default video styling */
video {
    border: none;
    outline: none;
    margin: 0;
    padding: 0;
}

/* Mobile-first responsive design */
h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Button improvements for mobile */
button {
    margin: 0.3em 0.2em;
    min-height: 44px; /* Touch target minimum */
    font-size: 0.9rem;
}

/* Mobile-first layout: small local video + vertical buttons side by side */
#controls {
    display: flex !important;
    flex-direction: row !important;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

#localVideoContainer {
    flex-shrink: 0;
    width: 120px !important;
    min-width: 120px;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    overflow: hidden;
}

#localVideo {
    width: 120px !important;
    height: 120px !important;
    max-width: 120px !important;
    aspect-ratio: 1/1;
    object-fit: cover;
    background: black;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    vertical-align: top;
}

#buttons {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

#buttons button {
    width: 100% !important;
    margin: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Current room and share section */
#currentRoom {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    border: none;
}

#currentRoom strong {
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* Auto-join button styling */
#autoJoinBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
    transition: all 0.3s ease !important;
}

#shareSection {
    margin: 1rem 0;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 8px;
}

#shareSection button {
    width: 100%;
    margin: 0.25rem 0;
}

/* Remote video takes main space */
#remoteVideoContainer {
    margin-top: 1rem;
}

#remoteVideo {
    background: black;
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: block;
}

/* Dialog improvements for mobile */
.mdc-dialog .mdc-dialog__surface {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
}

/* Tablet and desktop improvements */
@media (min-width: 768px) {
    body {
        padding: 0 2rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    /* Switch to traditional layout on larger screens */
    #controls {
        flex-direction: column !important;
        align-items: center;
    }
    
    #localVideoContainer {
        width: auto !important;
        margin-bottom: 1rem;
    }
    
    #localVideo {
        width: 200px !important;
        height: 200px !important;
        max-width: 200px !important;
        aspect-ratio: 1/1;
        object-fit: cover;
    }
    
    #buttons {
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
    
    #buttons button {
        width: auto !important;
        flex: 0 0 auto;
    }
    
    #shareSection button {
        width: auto;
        margin: 0 0.5rem 0 0;
        display: inline-flex;
    }
    
    /* Desktop: show videos side by side */
    #remoteVideoContainer {
        margin-top: 2rem;
    }
    
    #remoteVideo {
        width: 400px !important;
        height: 400px !important;
        max-width: 400px !important;
        aspect-ratio: 1/1;
        object-fit: cover;
        margin: 0 auto;
        display: block;
    }
}

@media (min-width: 1024px) {
    #remoteVideo {
        width: 500px !important;
        height: 500px !important;
        aspect-ratio: 1/1;
        object-fit: cover;
    }
}
