.camera-modal {
    position: fixed;
    inset: 0;
    /* top/right/bottom/left: 0 */
    display: none;
    /* 預設隱藏 */
    z-index: 9999;
}

.camera-modal.open {
    display: block;
}

.camera-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

/* 懸浮視窗本體：置中 */
.camera-modal-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    width: 640px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.camera-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #263238;
    color: #fff;
    font-size: 14px;
}

.camera-modal-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

.camera-modal-body {
    background: #000;
    padding: 0;
}

/* 讓影像自適應 */
#cameraStream {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 60px);
}

/* RWD 小螢幕 */
@media (max-width: 768px) {
    .camera-modal-panel {
        width: 100%;
        max-width: calc(100vw - 16px);
    }
}