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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(5px);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: 50px;
}

.header h1 {
    color: white;
    font-size: 1.4em;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.controls {
    display: flex;
    gap: 8px;
    margin: 0;
}

button {
    padding: 8px 16px;
    font-size: 14px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#startBtn {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
}

#stopBtn {
    background: linear-gradient(45deg, #f44336, #d32f2f);
    color: white;
}

#clearBtn {
    background: linear-gradient(45deg, #2196F3, #1976D2);
    color: white;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.main-content {
    position: relative;
    flex: 1;
    overflow: hidden;
    padding-top: 50px;
}

.video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    overflow: hidden;
}

#videoElement {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

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

.sidebar {
    position: absolute;
    top: 70px;
    right: 20px;
    width: 300px;
    max-height: calc(100vh - 120px);
    background: rgba(255,255,255,0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    overflow-y: auto;
    z-index: 20;
    backdrop-filter: blur(10px);
    cursor: move;
    user-select: none;
}

.sidebar:hover {
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    transform: translateY(-2px);
}

.sidebar.dragging {
    transition: none;
    transform: none;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.sidebar h2 {
    cursor: move;
    margin: 0;
    color: #333;
    font-size: 1.5em;
    flex: 1;
}

.toggle-btn {
    background: linear-gradient(45deg, #2196F3, #1976D2);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    line-height: 1;
}

.toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.sidebar.minimized {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
}

.sidebar.minimized .sidebar-content {
    display: none;
}

.sidebar.minimized {
    padding: 15px 20px;
}

.stats {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(45deg, #e3f2fd, #bbdefb);
    border-radius: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: bold;
}

.stat-label {
    color: #666;
}

.records {
    max-height: 400px;
    overflow-y: auto;
}

.record-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
    transition: all 0.3s ease;
}

.record-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.record-image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #4CAF50;
}

.record-info {
    flex: 1;
}

.record-score {
    font-size: 1.2em;
    font-weight: bold;
    color: #4CAF50;
}

.record-time {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

.success {
    text-align: center;
    padding: 20px;
    color: #4CAF50;
    background: #e8f5e8;
    border-radius: 8px;
    border: 1px solid #4CAF50;
    margin: 10px 0;
    font-weight: bold;
}

.error {
    text-align: center;
    padding: 20px;
    color: #f44336;
    background: #ffebee;
    border-radius: 8px;
    border: 1px solid #f44336;
    margin: 10px 0;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #666;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-records {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-style: italic;
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        height: auto;
        padding: 8px 10px;
        gap: 8px;
    }
    
    .header h1 {
        font-size: 1.2em;
        margin: 0;
    }
    
    .controls {
        gap: 6px;
    }
    
    button {
        padding: 10px 14px;
        font-size: 12px;
        border-radius: 20px;
    }
    
    .main-content {
        padding-top: 80px;
    }
    
    .sidebar {
        position: fixed;
        bottom: 10px;
        left: 10px;
        right: 10px;
        top: auto;
        width: auto;
        max-height: 40vh;
        border-radius: 10px;
        padding: 15px;
        z-index: 30;
        transition: all 0.3s ease;
    }
    
    .sidebar.minimized {
        max-height: none;
        bottom: 10px;
    }
    
    .sidebar h2 {
        font-size: 1.2em;
        margin-bottom: 10px;
    }
    
    .toggle-btn {
        width: 30px;
        height: 30px;
        font-size: 18px;
    }
    
    .stats {
        margin-bottom: 15px;
        padding: 10px;
    }
    
    .stat-item {
        font-size: 0.9em;
        margin-bottom: 5px;
    }
    
    .record-item {
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .record-image {
        width: 50px;
        height: 50px;
    }
    
    .record-score {
        font-size: 1em;
    }
    
    .record-time {
        font-size: 0.8em;
    }
    
    .records {
        max-height: 200px;
    }
    
    /* 移动端拖拽提示 */
    .sidebar::before {
        content: '';
    }
    
    .sidebar:not(.minimized)::before {
        content: '⋯';
        position: absolute;
        top: 5px;
        left: 50%;
        transform: translateX(-50%);
        color: #999;
        font-size: 20px;
        line-height: 1;
    }
}