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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1e1e1e 0%, #2d2d2d 100%);
    color: #e4e4e4;
    overflow: hidden;
    height: 100vh;
    touch-action: none;
}

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

.home-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    padding: 20px;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 1.8rem;
    background: linear-gradient(90deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: #8892b0;
    font-size: 0.9rem;
    margin-top: 5px;
}

.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.video-panel {
    flex: 1;
    position: relative;
    background: #000;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.viz-panel {
    flex: 1;
    background: #1a1a1a;
    position: relative;
}

#viz-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.status-bar {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    z-index: 10;
}

.status-item {
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-item .label {
    color: #8892b0;
    margin-right: 8px;
}

.status-item .value {
    color: #64ffda;
    font-weight: 600;
}

.controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 100;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

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

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

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

.info-panel {
    position: absolute;
    top: 80px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 250px;
    z-index: 10;
}

.info-panel h3 {
    font-size: 0.9rem;
    color: #64ffda;
    margin-bottom: 10px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    font-size: 0.8rem;
}

.info-item .label {
    color: #8892b0;
}

.info-item .value {
    color: #e4e4e4;
    font-weight: 600;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    margin-top: 20px;
    color: #8892b0;
}

/* 移动端适配 */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .container {
        height: auto;
        min-height: 100vh;
    }

    .main-layout {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 80px);
    }

    .video-panel {
        height: 40vh;
        min-height: 280px;
        position: relative;
        flex-shrink: 0;
    }

    .viz-panel {
        height: 50vh;
        min-height: 400px;
        position: relative;
        flex-shrink: 0;
        margin-bottom: 80px;
    }

    header {
        padding: 12px;
    }

    header h1 {
        font-size: 1.1rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .status-bar {
        flex-direction: row;
        gap: 4px;
        top: 5px;
        left: 5px;
        right: 5px;
        flex-wrap: wrap;
    }

    .status-item {
        padding: 4px 8px;
        font-size: 0.7rem;
        flex: 0 0 auto;
    }

    .controls {
        position: fixed;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        gap: 8px;
        flex-wrap: nowrap;
        width: auto;
        max-width: calc(100vw - 20px);
        background: rgba(0, 0, 0, 0.9);
        padding: 10px;
        border-radius: 12px;
        backdrop-filter: blur(10px);
        z-index: 1000;
    }

    .btn {
        padding: 14px 18px;
        font-size: 0.85rem;
        flex: 1;
        min-width: 80px;
        white-space: nowrap;
    }

    .info-panel {
        top: 50px;
        right: 5px;
        left: auto;
        max-width: 140px;
        padding: 6px;
        font-size: 0.65rem;
        z-index: 50;
    }

    .info-panel h3 {
        font-size: 0.7rem;
        margin-bottom: 5px;
    }

    .info-item {
        font-size: 0.65rem;
        margin: 2px 0;
    }

    .home-btn {
        width: 36px;
        height: 36px;
        top: 8px;
        left: 8px;
        font-size: 18px;
        z-index: 1001;
    }

    #viz-canvas {
        width: 100% !important;
        height: 100% !important;
    }
}
