:root {
    --primary-color: #2196F3;
    --secondary-color: #607D8B;
    --background: #f5f5f5;
    --card-bg: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --success: #4CAF50;
    --error: #F44336;
    --sidebar-width: 380px;
}

body {
    font-family: "Segoe UI", system-ui, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    /*min-height: 80vh;*/
    /*min-width: 800px;*/
}

#container {
    display: flex;
    flex-wrap: wrap; /* 允许换行 */
    gap: 0.5rem;
    max-width: 1600px;
    margin: 0 auto;
    padding-bottom: 5rem;
    justify-content: center;
}

#sidebar {
    /*flex: 1 1 var(--sidebar-width);*/
    /*min-width: 300px; !* 最小宽度 *!*/
    max-width: 100%; /* 移动端限制最大宽度 */
    padding: 1.5rem;
    justify-items: center;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
}

#title {
    color: var(--primary-color);
    font-size: 2.2rem;
    font-weight: 700;
    margin: 1rem 0 2rem;
    text-align: center;
    letter-spacing: -0.5px;
}

#description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #eee;
    max-width: 680px;
}

#description ul {
    margin: 0.8rem 0;
    padding-left: 1.5rem;
}

#description li {
    margin-bottom: 0.5rem;
}

#controlPanel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0.5rem 0;
    width: 100%;
    gap: 0.5rem;
}

#controlParams {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
}

#lambdaInput {
    display: flex;
    flex-direction: row;
    gap: 0.2rem;
}

/*#authorization {*/
/*    background: var(--secondary-color);*/
/*    color: white;*/
/*    padding: 0.5rem 0.5rem;*/
/*    font-size: 1.1rem;*/
/*    border-radius: 8px;*/
/*    border: none;*/
/*    cursor: pointer;*/
/*    transition: all 0.2s ease;*/
/*    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);*/
/*}*/

#switchButton {
    background: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 90%;
}

/*#cameraSelectDropdown {*/
/*    background: var(--secondary-color);*/
/*    color: white;*/
/*    padding: 0.5rem 0.5rem;*/
/*    font-size: 1.1rem;*/
/*    border-radius: 8px;*/
/*    border: none;*/
/*    cursor: pointer;*/
/*    transition: all 0.2s ease;*/
/*    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);*/
/*    option {*/
/*        background-color: #606060;*/
/*    }*/
/*}*/

#switchButton:hover {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

#textDisplay {
    display: flex;
    min-height: 0; /* 允许内容压缩 */
}

#debugInfo {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.value-box, .numeralValue {
    width: 2rem;
}

#viewPanel {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem;
}

#cameraDisplay {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    box-sizing: border-box;
    padding-bottom: 1rem;
}

#videoInput {
    position: absolute;
    top: -9999px;
}

#cameraPreview {
    position: relative;
}

#previewTitle {
    display: flex;
    color: var(--secondary-color);
    font-size: 1.4rem;
    /*font-weight: 600;*/
    margin-bottom: 1rem;
    width: 36rem;
}

#plotContent {
    border: 1px solid #ffe0e0;
}

#plotCanvas {
    width: 100%;
    height: 200px;
    display: block; /* 避免 canvas 默认 inline 间隙 */
}

@media (max-width: 640px) {
    #container {
        flex-direction: column;
        padding: 1rem;
    }

    #sidebar {
        flex: none;
        width: auto;
    }

    #videoInput, #plotCanvas {
        max-width: 100%;
        max-height: 100px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    #title {
        font-size: 1.8rem;
    }

    #description {
        padding: 1rem;
        font-size: 0.9rem;
    }

    .controlButtons {
        width: 100%;
        padding: 1rem;
    }
}

.canvas-wrapper {
    position: relative;
    /*width: 640px;  !* 与视频分辨率匹配 *!*/
    /*height: 480px;*/
    width: 480px;
    height: 360px;
    margin: 0 auto; /* 居中显示 */
}

#previewCanvas,
#overlayCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain; /* 保持原始比例 */
}

.status-bar {
    flex-wrap: wrap;
    display: flex;
    gap: 20px;
    align-items: baseline;
    font-size: 18px;
}

.metric-item {
    display: flex;
    align-items: baseline;
}

.value-container {
    font-family: "Courier New", monospace; /* 强等宽字体 */
    width: 6ch;   /* 6字符宽度 */
    text-align: left;
    white-space: pre; /* 保留空格 */
    margin: 0 0.3em;
}

.metric-label {
    white-space: nowrap;
}

.unit {
    margin-left: 0.2em;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .status-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .canvas-wrapper {
        padding-top: 100%; /* 移动端改为正方形比例 */
    }
}

@media (max-width: 480px) {
    #sidebar {
        padding: 1rem;
    }

    .controlButtons {
        width: 100%;
        padding: 12px;
    }

    #plotCanvas {
        height: 150px;
    }
}

.image-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 2rem; /* 控制图片间距 */
    padding: 2px;
    background: #f0f0f0; /* 底部背景色 */
}

.image-wrapper {
    width: 12rem; /* 控制图片显示宽度 */
    height: 6rem; /* 控制图片显示高度 */
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 保持原始比例 */
}

.teaser-image {
    flex: 0 1 auto; /* 允许缩小 */
    max-width: 300px;
    min-width: 160px;
    width: auto; /* 根据内容自适应 */
    margin-right: 1rem; /* 替代gap的间距效果 */
}

.teaser-container {
    display: flex;
    /*margin-bottom: 1.5rem;*/
    align-items: flex-start;
    max-width: 720px;
}

.teaser-image img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    object-fit: cover;
}
