/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #121212;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    height: 100vh;
    display: flex;
    justify-content: center;
    overflow: hidden;
    /* Prevent scroll on mobile */
}

.app-container {
    width: 100%;
    max-width: 600px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 15px;
    position: relative;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 20px;
    background: #1e1e1e;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.id-input {
    background: transparent;
    border: none;
    color: #00e0ff;
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    width: 100%;
    letter-spacing: 2px;
}

/* Connection Bar */
.connect-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.target-input {
    flex: 2;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 50px;
    padding: 12px 20px;
    color: white;
    font-size: 16px;
    text-align: center;
    transition: all 0.3s;
}

.target-input:focus {
    border-color: #00e0ff;
    background: #333;
}

.btn-primary {
    flex: 1;
    background: linear-gradient(135deg, #28a745, #218838);
    border: none;
    border-radius: 50px;
    color: white;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(40, 167, 69, 0.3);
    transition: transform 0.2s;
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-primary:disabled {
    background: #444;
    box-shadow: none;
    color: #888;
    cursor: not-allowed;
}

/* Video Grid */
.video-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    min-height: 0;
}

.video-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.video-wrapper.local {
    flex: 1;
    border: 1px solid #333;
}

.video-wrapper.remote {
    flex: 2;
    border: 1px solid #333;
}

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

#localVideo {
    transform: scaleX(-1);
}

.video-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    pointer-events: none;
}

/* Status */
.status-text {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin: 10px 0;
    height: 15px;
}

/* Bottom Action Bar */
.action-bar {
    background: #1e1e1e;
    border-radius: 20px;
    padding: 10px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.btn-icon {
    background: transparent;
    border: none;
    color: #bbb;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    cursor: pointer;
    width: 60px;
}

.btn-icon .icon {
    font-size: 24px;
    background: #2d2d2d;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:active .icon {
    transform: scale(0.9);
}

.btn-icon.active-green .icon {
    background: #28a745;
    color: white;
}

/* Countdown Overlay */
#countdown-overlay {
    position: fixed;
    /* Fixed to cover screen even on scroll */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    /* Dim backdrop */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.popup-card {
    background: #1e1e1e;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 80%;
    max-width: 320px;
    border: 1px solid #333;
    animation: popupIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popupIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.count-number {
    font-size: 80px;
    color: #00e0ff;
    font-weight: bold;
    margin: 10px 0;
    font-variant-numeric: tabular-nums;
    /* Monospaced numbers */
}

.count-text {
    font-size: 14px;
    color: #888;
}

.hidden {
    display: none !important;
}