/* body {
    margin: 0;
    padding: 0;
    background: #000;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;

    width: 100vw;
    height: 100vh;
    position: fixed;
} */

.hidden {
    display: none;
}

body.fullscreen-mode {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000;
}

#video-container.active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    margin: 0;
    padding: 0;
    z-index: 9998;
    overflow: hidden;
}

#remoteVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background-color: #000;
    margin: 0;
    padding: 0;
    
    /* Mac Chrome锯齿优化 - 针对remoteVideo元素 */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
    
    /* 确保高质量渲染 */
    image-rendering: smooth;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-quality;
    
    /* 抗锯齿 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* 防止子像素偏移 */
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    
    /* 确保像素对齐 */
    will-change: transform;
}

#playButton {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 40px;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
}

#playButton:hover {
    background: rgba(255, 255, 255, 0.3);
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.3s;
}

.video-container:hover .video-controls {
    opacity: 1;
}

.control-button {
    background: transparent;
    border: none;
    color: white;
    padding: 5px 10px;
    cursor: pointer;
    margin-left: 10px;
}

.control-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.notification.show {
    opacity: 1;
}

.notification.success {
    background: rgba(46, 125, 50, 0.9);
}

.notification.error {
    background: rgba(198, 40, 40, 0.9);
}

.notification.warning {
    background: rgba(251, 140, 0, 0.9);
}

.web-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    overflow: hidden !important;
}

/* .video-control {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    cursor: move;
    z-index: 1000;
    user-select: none;
    transition: opacity 0.3s;
}

.video-control:hover {
    opacity: 1;
}

.video-control button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-control button:hover {
    background: rgba(255, 255, 255, 0.1);
} 

:fullscreen .video-control {
    position: fixed;
}*/
video {
    /* 尝试让浏览器优先考虑质量而不是速度 */
    /* image-rendering: high-quality; */

    /* 其他可能的值 (效果因浏览器而异): */
    image-rendering: smooth;
    /* 类似 high-quality，新标准 */
    /* image-rendering: auto; /* 默认值，由浏览器决定 */
    /* image-rendering: crisp-edges; /* 保留硬边缘，适合像素艺术，不适合视频 */
    /* image-rendering: pixelated; /* 放大时显示像素块，不适合视频 */
    
    /* 针对Mac Chrome锯齿问题的优化 */
    -webkit-transform: translateZ(0); /* 强制硬件加速 */
    -webkit-backface-visibility: hidden; /* 隐藏背面，减少渲染负担 */
    -webkit-perspective: 1000; /* 启用3D渲染上下文 */
    transform: translateZ(0); /* 标准属性 */
    backface-visibility: hidden;
    
    /* 抗锯齿优化 */
    -webkit-font-smoothing: antialiased; /* WebKit抗锯齿 */
    -moz-osx-font-smoothing: grayscale; /* Firefox在macOS上的抗锯齿 */
    
    /* 像素完美渲染 */
    image-rendering: -webkit-optimize-contrast; /* WebKit优化对比度 */
    image-rendering: optimize-quality; /* 优化质量 */
    
    /* 确保子像素渲染 */
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    
    /* 防止模糊 */
    -webkit-filter: blur(0);
    filter: blur(0);
}

/* 确保视频元素不显示默认控制条 */
video::-webkit-media-controls {
    display: none !important;
}

video::-webkit-media-controls-enclosure {
    display: none !important;
}

video::-webkit-media-controls-panel {
    display: none !important;
}

/* 视频容器样式 */
#videoContainer {
    position: relative;
    width: 100%;
    height: 100%;
}

#remoteVideo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 处理屏幕旋转 */
@media screen and (orientation: portrait) {
    .video-container {
        transform: rotate(-90deg);
        transform-origin: center center;
        width: 100vh !important;
        height: 100vw !important;
        position: absolute;
        top: calc((100vh - 100vw) / 2);
        left: calc((100vw - 100vh) / 2);
    }
}

@media screen and (orientation: landscape) {
    .video-container {
        transform: none;
        width: 100% !important;
        height: 100% !important;
        position: relative;
        top: 0;
        left: 0;
    }
}

/* Add a class to the body when in fullscreen mode */
body.fullscreen-mode {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000;
}

/* Room page styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 650px;
    margin: 40px auto;
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eaeaea;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pwa-btn {
    background-color: #2196f3;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.pwa-btn:hover {
    background-color: #1976d2;
    transform: scale(1.05);
}

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

.turn-config-btn {
    background-color: #2196f3;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.turn-config-btn:hover {
    background-color: #1976d2;
    transform: scale(1.05);
}

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

.turn-config-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.pwa-icon {
    width: 20px;
    height: 20px;
}

h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    color: #2c3e50;
}

.status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
}

.online {
    background-color: #4caf50;
    color: white;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.offline {
    background-color: #f44336;
    color: white;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}

.room-info {
    margin-bottom: 25px;
    background-color: #fafafa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #2196f3;
}

.room-info p {
    margin: 10px 0;
    font-size: 15px;
}

.room-info strong {
    color: #2c3e50;
}

.screenshot {
    width: 100%;
    border-radius: 8px;
    margin-top: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.screenshot:hover {
    transform: scale(1.02);
}

.message-input {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-sizing: border-box;
    resize: vertical;
    font-family: inherit;
    font-size: 15px;
    transition: border 0.3s ease, box-shadow 0.3s ease;
}

.message-input:focus {
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
    outline: none;
}

.connect-btn {
    background-color: #2196f3;
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.connect-btn:hover:not(:disabled) {
    background-color: #1976d2;
    box-shadow: 0 6px 16px rgba(33, 150, 243, 0.4);
    transform: translateY(-2px);
}

.connect-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.connect-btn:disabled {
    background-color: #e0e0e0;
    color: #9e9e9e;
    cursor: not-allowed;
    box-shadow: none;
}

.countdown-container {
    background-color: #f5f9ff;
    border: 1px solid #e3f2fd;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.countdown-title {
    font-size: 14px;
    color: #546e7a;
    margin-bottom: 8px;
    font-weight: 500;
}

.countdown-timer {
    font-size: 22px;
    font-weight: 600;
    color: #e53935;
    margin: 10px 0;
}

.countdown-expired {
    color: #e53935;
    font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        margin: 20px auto;
        padding: 20px;
        border-radius: 10px;
    }

    h1 {
        font-size: 22px;
    }
}

/* Dark mode support for room page */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #e0e0e0;
    }

    .container {
        background-color: #1e1e1e;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    }

    .header {
        border-bottom-color: #333;
    }

    h1 {
        color: #e0e0e0;
    }

    .room-info {
        background-color: #252525;
        border-left-color: #1976d2;
    }

    .room-info strong {
        color: #90caf9;
    }

    .message-input {
        background-color: #2d2d2d;
        border-color: #444;
        color: #e0e0e0;
    }

    .message-input:focus {
        border-color: #1976d2;
        box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
    }

    .countdown-container {
        background-color: #252525;
        border-color: #333;
    }

    .countdown-title {
        color: #b0bec5;
    }
}