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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: #1d1d1f;
    margin-bottom: 8px;
    font-weight: 600;
}

header p {
    color: #86868b;
    font-size: 1.1rem;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    margin-bottom: 40px;
}

.mouse-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#mouseCanvas {
    border: 2px solid #f0f0f0;
    border-radius: 15px;
    cursor: none;
    background: #fafafa;
    margin-bottom: 20px;
}

.gesture-display {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.current-gesture {
    text-align: center;
}

#gestureText {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1d1d1f;
    display: block;
    margin-bottom: 10px;
}

.confidence-bar {
    background: #e5e5e7;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

#confidenceLevel {
    height: 100%;
    background: linear-gradient(90deg, #007AFF, #34C759);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-group, .stats-group, .gesture-log {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.settings-group h3, .stats-group h3, .gesture-log h3 {
    margin-bottom: 15px;
    color: #1d1d1f;
    font-size: 1.1rem;
    font-weight: 600;
}

.setting {
    margin-bottom: 15px;
}

.setting label {
    display: block;
    margin-bottom: 8px;
    color: #515154;
    font-weight: 500;
}

.setting input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e5e5e7;
    outline: none;
    -webkit-appearance: none;
}

.setting input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007AFF;
    cursor: pointer;
}

.setting input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

.stat {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.stat span:first-child {
    min-width: 120px;
    font-size: 0.9rem;
    color: #515154;
}

.stat-bar {
    flex: 1;
    height: 6px;
    background: #e5e5e7;
    border-radius: 3px;
    overflow: hidden;
}

.stat-bar div {
    height: 100%;
    background: #007AFF;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.stat-bar.battery div {
    background: linear-gradient(90deg, #34C759, #FFCC00, #FF3B30);
}

.stat span:last-child {
    min-width: 50px;
    font-size: 0.9rem;
    color: #515154;
    text-align: right;
}

.history-list {
    max-height: 150px;
    overflow-y: auto;
}

.history-item {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
    color: #515154;
}

.history-item:last-child {
    border-bottom: none;
}

.tutorial-toggle {
    display: flex;
    gap: 10px;
}

.tutorial-toggle button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #007AFF;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.tutorial-toggle button:hover {
    background: #0056d6;
}

.tutorial-toggle button:last-child {
    background: #FF3B30;
}

.tutorial-toggle button:last-child:hover {
    background: #d12b20;
}

.tutorial {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.tutorial.hidden {
    display: none;
}

.tutorial-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    margin: 20px;
}

.tutorial-content h3 {
    margin-bottom: 20px;
    color: #1d1d1f;
    font-size: 1.5rem;
}

.gesture-guide {
    margin-bottom: 20px;
}

.gesture-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.gesture-item:last-child {
    border-bottom: none;
}

.gesture-item strong {
    color: #007AFF;
}

#closeTutorial {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    background: #007AFF;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
}

#closeTutorial:hover {
    background: #0056d6;
}

footer {
    text-align: center;
    padding: 20px;
    color: #86868b;
}

footer a {
    color: #007AFF;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .controls-panel {
        order: -1;
    }
    
    #mouseCanvas {
        width: 100%;
        max-width: 400px;
        height: auto;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .tutorial-content {
        margin: 10px;
        padding: 20px;
    }
}

/* Smooth animations */
* {
    transition: all 0.3s ease;
}

button, input[type="range"], input[type="checkbox"] {
    transition: all 0.2s ease;
}

/* Custom scrollbar */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}