:root {
    --bg-color: #000000;
    --surface-color: #111111;
    --border-color: #222222;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --accent-color: #ffffff;
    --accent-hover: #e0e0e0;
    --danger-color: #ef4444;
    --radius-lg: 12px;
    --radius-md: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Modals */
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.hidden { display: none !important; }

.modal {
    background: #1a1a1a;
    padding: 2rem;
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--border-color);
}
.modal h1 { margin-bottom: 1rem; font-size: 1.5rem; }
.modal p { color: var(--text-secondary); margin-bottom: 1.5rem; }
.modal-buttons { display: flex; gap: 1rem; justify-content: center; }

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
}
.btn-primary { background: #3b82f6; color: white; }
.btn-secondary { background: transparent; border: 1px solid var(--text-secondary); color: white; }
.text-danger { color: var(--danger-color); }

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 10px;
    gap: 10px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    height: 40px;
    flex-shrink: 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    font-style: italic;
    letter-spacing: -1px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.status-indicator {
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
}

.main-layout {
    display: flex;
    gap: 10px;
    flex: 1;
    overflow: hidden;
}

/* Video Column */
.video-column {
    width: 45%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.video-box {
    background: #0a0a0a;
    border-radius: var(--radius-lg);
    border: 1px solid #1a1a1a;
    position: relative;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay-icons {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
}

.video-logo {
    position: absolute;
    bottom: 15px;
    left: 15px;
    z-index: 10;
    font-size: 1rem;
    font-weight: 700;
    font-style: italic;
    color: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    gap: 5px;
}

.local-controls {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    gap: 10px;
    z-index: 20;
}

.local-control-btn {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.local-control-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.local-control-btn.is-active {
    background: rgba(0, 0, 0, 0.72);
    border-color: rgba(248, 113, 113, 0.95);
    color: #fca5a5;
}

.local-control-btn:active {
    transform: scale(0.96);
}

.local-control-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.media-settings-modal {
    max-width: 460px;
}

.media-field {
    text-align: left;
    margin-bottom: 12px;
}

.media-field label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.media-field select {
    width: 100%;
    background: #101010;
    border: 1px solid #333;
    color: #fff;
    border-radius: var(--radius-md);
    padding: 0.7rem 0.8rem;
    font-size: 0.95rem;
    outline: none;
}

.media-field select:focus {
    border-color: #4b5563;
}

.media-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.watermark {
    position: absolute;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1rem;
    pointer-events: none;
}

/* Chat Column */
.chat-column {
    flex: 1;
    background: #141414;
    border-radius: var(--radius-lg);
    border: 1px solid #1f1f1f;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.system-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.chat-message {
    font-size: 0.95rem;
    word-break: break-word;
    line-height: 1.4;
}

.chat-message .sender-stranger { color: #ef4444; font-weight: bold; margin-right: 5px; }
.chat-message .sender-you { color: #3b82f6; font-weight: bold; margin-right: 5px; }

/* Chat Controls */
.chat-controls {
    display: flex;
    padding: 15px;
    gap: 15px;
    background: #0f0f0f;
    border-top: 1px solid #1f1f1f;
}

.btn-start, .btn-send {
    background: white;
    color: black;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: opacity 0.2s;
}

.btn-start:hover, .btn-send:hover { opacity: 0.8; }
.btn-start:disabled, .btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-start {
    width: 100px;
    height: 65px;
}
.btn-start .btn-title { font-size: 1.1rem; }
.btn-start .btn-subtitle { font-size: 0.8rem; color: #666; }

.btn-send {
    width: 100px;
    height: 65px;
    font-size: 1.1rem;
}

.chat-input {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    color: white;
    padding: 0 1.5rem;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    outline: none;
    height: 65px;
}

.chat-input:focus {
    border-color: #555;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        position: fixed; /* Prevent body scroll */
        width: 100%;
    }
    
    .app-container {
        height: 100dvh;
        gap: 5px;
        padding: 5px;
    }

    header {
        height: 30px;
    }

    .main-layout {
        flex-direction: column;
        gap: 5px;
        height: calc(100dvh - 45px);
    }

    .video-column {
        width: 100%;
        height: 75dvh; /* The cameras take up 75% of the height */
        display: flex;
        flex-direction: column;
        gap: 5px;
        flex: 0 0 auto;
    }

    .video-box {
        flex: 1; /* Both cameras share the 75% height equally */
        width: 100%;
        height: auto;
        aspect-ratio: auto;
    }

    .chat-column {
        flex: 1; /* Chat takes the remaining 25% */
        min-height: 0;
    }

    .chat-column {
        flex: 1;
        min-height: 0;
    }

    .chat-messages {
        padding: 10px;
    }

    .chat-controls {
        padding: 8px;
        gap: 8px;
    }

    .chat-input, .btn-start, .btn-send {
        height: 50px;
        font-size: 0.9rem;
    }

    .btn-start, .btn-send {
        width: 70px;
    }

    .video-logo { display: none; }

    .local-controls {
        right: 8px;
        bottom: 8px;
        gap: 8px;
    }

    .local-control-btn {
        width: 56px;
        height: 56px;
    }

    .local-control-btn svg {
        width: 26px;
        height: 26px;
    }
}

.ad-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #000;
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.ad-content {
    width: 90%;
    max-width: 400px;
}

.ad-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    letter-spacing: 2px;
}

.ad-banner-slot {
    width: 300px;
    max-width: 100%;
    margin: 0 auto 10px;
    min-height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.ad-banner-slot iframe {
    border: 0;
    max-width: 100%;
}

#ad-timer {
    font-size: 0.9rem;
    color: var(--text-primary);
}
