* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2.5em;
}

/* 上传区域 */
.upload-section {
    margin-bottom: 30px;
}

.upload-box {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8f9ff;
}

.upload-box:hover {
    border-color: #764ba2;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.upload-content svg {
    color: #667eea;
    margin-bottom: 15px;
}

.upload-content p {
    font-size: 1.2em;
    font-weight: 600;
    color: #667eea;
    margin: 10px 0;
}

.upload-content span {
    color: #999;
    font-size: 0.9em;
}

.preview-box {
    text-align: center;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 15px;
}

.preview-box img {
    max-width: 300px;
    max-height: 300px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 15px;
}

.btn-change {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
}

.btn-change:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

/* 控制按钮 */
.control-section {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-primary, .btn-secondary {
    padding: 15px 40px;
    font-size: 1.1em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background: #d0d0d0;
    transform: translateY(-2px);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none; /* 禁用时不能点击 */
}

/* 停止按钮始终可点击 */
#stopBtn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

#stopBtn:disabled {
    pointer-events: auto !important; /* 即使disabled也可以点击 */
    cursor: pointer !important;
    opacity: 0.7; /* 稍微透明表示未运行状态 */
}

/* 画布容器 */
.canvas-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 30px;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

#renderCanvas {
    width: 100%;
    height: 600px;
    display: block;
}

#webcamCanvas {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 150px;
    height: 112px;
    border: 2px solid #fff;
    border-radius: 8px;
    opacity: 0.8;
    z-index: 20;
    background: #000;
}

.canvas-container video {
    border-radius: 15px;
}

.status {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9em;
}

/* 设备状态区域 */
.device-status-section {
    margin-bottom: 20px;
}

.device-status {
    background: #f8f9ff;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}

.device-status .status-icon {
    font-size: 1.5em;
    line-height: 1;
}

.device-status .status-text {
    flex: 1;
    font-size: 0.95em;
    color: #555;
    white-space: pre-line;
    line-height: 1.5;
}

.device-status.status-success {
    background: #f0f9ff;
    border-color: #10b981;
    color: #065f46;
}

.device-status.status-success .status-text {
    color: #065f46;
}

.device-status.status-error {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

.device-status.status-error .status-text {
    color: #991b1b;
}

.device-status.status-warning {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

.device-status.status-warning .status-text {
    color: #92400e;
}

.device-status.status-info {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

.device-status.status-info .status-text {
    color: #1e40af;
}

/* 信息区域 */
.info-section {
    background: #f8f9ff;
    padding: 25px;
    border-radius: 15px;
    margin-top: 30px;
}

.info-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section li {
    padding: 10px 0;
    color: #555;
    font-size: 1em;
    border-bottom: 1px solid #e0e0e0;
}

.info-section li:last-child {
    border-bottom: none;
}

/* 响应式设计 - 移动端优化 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        border-radius: 15px;
    }

    h1 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }

    #renderCanvas {
        height: 50vh;
        min-height: 300px;
        max-height: 500px;
    }

    .canvas-container {
        max-width: 100%;
    }

    .control-section {
        flex-direction: column;
        gap: 10px;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
        padding: 12px 20px;
        font-size: 1em;
    }

    .upload-box {
        padding: 30px 20px;
    }

    .preview-box img {
        max-width: 200px;
        max-height: 200px;
    }

    .info-section {
        padding: 15px;
        font-size: 0.9em;
    }

    .status {
        font-size: 0.8em;
        padding: 8px 15px;
    }

    #webcamCanvas {
        width: 120px;
        height: 90px;
        top: 5px;
        right: 5px;
    }
}

/* 移动端横屏适配 */
@media (max-width: 768px) and (orientation: landscape) {
    #renderCanvas {
        height: 60vh;
    }
}
