/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 返回主页按钮 */
.home-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.home-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    min-height: 100vh;
    color: #fff;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5, #00d2ff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shine 3s linear infinite;
}

@keyframes shine {
    to { background-position: 200% center; }
}

.subtitle {
    color: #a0a0a0;
    font-size: 1.1rem;
}

/* 状态栏 */
.status-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-item .label {
    color: #888;
    font-size: 0.9rem;
}

.status-item .value {
    font-weight: bold;
    color: #00d2ff;
    min-width: 50px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.status-item .value.webgpu {
    color: #00ff88;
}

.status-item .value.wasm {
    color: #ffaa00;
}

/* 主内容区域 */
.main-content {
    margin-bottom: 20px;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#video {
    width: 100%;
    display: block;
}

#overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 全屏按钮 */
.fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.video-container:fullscreen {
    max-width: none;
    border-radius: 0;
}

.video-container:fullscreen .fullscreen-btn {
    top: 20px;
    right: 20px;
}

/* 加载覆盖层 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #333;
    border-top-color: #00d2ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-text {
    color: #fff;
    font-size: 1.1rem;
}

/* 进度条样式 */
.progress-container {
    width: 80%;
    max-width: 300px;
    margin-top: 15px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 8px;
    font-size: 0.9rem;
    color: #aaa;
    text-align: center;
}

/* 控制面板 */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 0.9rem;
    color: #ccc;
}

/* 滑块样式 */
input[type="range"] {
    width: 150px;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* 下拉选择框 */
select {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 150px;
}

select option {
    background: #333;
    color: #fff;
}

/* 按钮样式 */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

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

.btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    color: #fff;
}

/* 检测结果 */
.detection-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

.detection-info h3 {
    margin-bottom: 15px;
    color: #00d2ff;
}

.detection-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 50px;
}

.detection-list .placeholder {
    color: #666;
    font-style: italic;
}

.detection-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: rgba(0, 210, 255, 0.2);
    border-radius: 20px;
    font-size: 0.9rem;
}

.detection-item.person {
    background: rgba(255, 107, 107, 0.3);
    border: 1px solid rgba(255, 107, 107, 0.5);
}

.detection-item.vehicle {
    background: rgba(78, 205, 196, 0.3);
    border: 1px solid rgba(78, 205, 196, 0.5);
}

.detection-item.animal {
    background: rgba(255, 190, 118, 0.3);
    border: 1px solid rgba(255, 190, 118, 0.5);
}

.detection-item .confidence {
    color: #00ff88;
    font-weight: bold;
}

/* 说明区域 */
.instructions {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.instructions h3 {
    margin-bottom: 15px;
    color: #feca57;
}

.class-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.1);
}

.tag.person {
    background: rgba(255, 107, 107, 0.3);
}

.tag.vehicle {
    background: rgba(78, 205, 196, 0.3);
}

.tag.animal {
    background: rgba(255, 190, 118, 0.3);
}

.tag.object {
    background: rgba(155, 89, 182, 0.3);
}

.tag.more {
    background: rgba(255, 255, 255, 0.2);
    color: #888;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .status-bar {
        flex-direction: column;
        gap: 10px;
    }

    .controls {
        flex-direction: column;
    }

    .control-group {
        width: 100%;
    }

    input[type="range"],
    select {
        width: 100%;
    }

    .btn {
        width: 100%;
    }
}
