/* --- 基本样式 (保持或微调) --- */
body { font-family: sans-serif; margin: 20px; background-color: #f4f4f4; color: #333; }
#app-container { max-width: 800px; /* 可能需要更宽以容纳 640px 视频 */ margin: auto; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
h1, h2 { text-align: center; color: #333; }
#camera-section, #food-list-section, #calorie-summary-section { margin-bottom: 30px; padding: 15px; border: 1px solid #ddd; border-radius: 5px; }

/* --- 摄像头与控制 --- */
.camera-options, .zoom-control { text-align: center; margin-bottom: 10px; }
.camera-options label, .zoom-control label { margin-right: 5px; }
#camera-select { padding: 5px; border-radius: 4px; min-width: 150px; }
#zoom-slider { vertical-align: middle; max-width: 150px;}
#zoom-value { display: inline-block; min-width: 35px; text-align: right; vertical-align: middle; }

/* --- 实时画面容器 (重要) --- */
#live-view-container {
    position: relative; /* 让内部的 canvas 可以绝对定位 */
    width: 640px;       /* 容器尺寸等于视频尺寸 */
    height: 480px;      /* 容器尺寸等于视频尺寸 */
    margin: 10px auto;
    border: 1px solid #ccc;
    background-color: #eee;
}

#camera-view {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* 镜像 */
}

#overlay-canvas {
    position: absolute; /* 覆盖在 video 上方 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* 让鼠标事件穿透到 video (如果需要的话) */
    transform: scaleX(-1); /* **重要：**同样镜像，使坐标系匹配镜像后的视频 */
}

/* --- 按钮样式 --- */
#control-buttons { display: flex; justify-content: center; gap: 15px; margin-top: 15px; }
button { /* 共享样式 */
    padding: 10px 15px; background-color: #5cb85c; color: white;
    border: none; border-radius: 4px; cursor: pointer; font-size: 1em;
}
button:hover { background-color: #4cae4c; }
button:disabled { background-color: #ccc; cursor: not-allowed; }
#retake-btn { background-color: #f0ad4e; } /* 橙色 */
#retake-btn:hover { background-color: #ec971f; }
#add-detected-btn { background-color: #337ab7; } /* 蓝色 */
#add-detected-btn:hover { background-color: #286090; }

/* --- 其他样式 (食物列表，卡路里等保持不变) --- */
#food-items-container .food-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid #eee; }
#food-items-container .food-item:last-child { border-bottom: none; }
#food-items-container input[type="text"], #food-items-container input[type="number"] { padding: 8px; border: 1px solid #ccc; border-radius: 4px; flex-grow: 1; }
#food-items-container input[type="text"] { min-width: 150px; }
#food-items-container input[type="number"] { width: 80px; flex-grow: 0; }
#food-items-container .remove-item-btn { background-color: #d9534f; padding: 5px 10px; font-size: 0.9em; margin: 0; }
#food-items-container .remove-item-btn:hover { background-color: #c9302c; }
#total-calories-display { font-weight: bold; font-size: 1.2em; color: #d9534f; }
#recognition-status, #loading-model-status, #loading-camera-status { text-align: center; margin-top: 10px; font-style: italic; }