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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s ease;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 20px 20px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #4f46e5;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stress-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #64748b;
    font-weight: 600;
}

.stress-bar {
    width: 200px;
    height: 8px;
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.stress-fill {
    height: 100%;
    background: linear-gradient(90deg, #06d6a0 0%, #4ade80 100%);
    transition: width 0.5s ease;
    border-radius: 4px;
    width: 0%;
}

.settings-icon {
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.settings-icon:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: rotate(45deg);
}

.fidget-panel {
    position: fixed;
    top: 90px;
    left: 20px;
    width: 200px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    z-index: 999;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.fidget-panel.collapsed {
    transform: translateX(-160px);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: 600;
    color: #374151;
}

.collapse-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.collapse-btn:hover {
    background: rgba(99, 102, 241, 0.1);
}

.toy-categories {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toy-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.toy-item:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(5px);
}

.toy-item.active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-color: #4f46e5;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.toy-icon {
    font-size: 24px;
    width: 32px;
    text-align: center;
}

.toy-item span {
    font-weight: 500;
}

#canvas {
    display: block;
    cursor: crosshair;
    touch-action: none;
}

.controls-panel {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 999;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-btn {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.control-btn:active {
    transform: translateY(0);
}

.volume-slider {
    width: 80px;
    height: 6px;
    border-radius: 3px;
    background: rgba(148, 163, 184, 0.3);
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.timer {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: #64748b;
    font-size: 14px;
}

.stats-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.stats-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    min-width: 300px;
}

.stats-content h3 {
    margin-bottom: 20px;
    color: #374151;
    font-size: 24px;
    text-align: center;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 1px solid #e5e7eb;
}

.stats-content button {
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stats-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* Focus Mode */
body.focus-mode .fidget-panel,
body.focus-mode .controls-panel,
body.focus-mode .header {
    opacity: 0.3;
    pointer-events: none;
}

body.focus-mode .fidget-panel:hover,
body.focus-mode .controls-panel:hover,
body.focus-mode .header:hover {
    opacity: 1;
    pointer-events: all;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header {
        height: 60px;
        padding: 0 15px;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    .stress-bar {
        width: 120px;
    }
    
    .fidget-panel {
        width: 160px;
        padding: 15px;
        top: 80px;
        left: 10px;
    }
    
    .fidget-panel.collapsed {
        transform: translateX(-130px);
    }
    
    .toy-item {
        padding: 8px;
        gap: 8px;
    }
    
    .toy-icon {
        font-size: 20px;
        width: 24px;
    }
    
    .controls-panel {
        bottom: 15px;
        padding: 12px 20px;
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .volume-slider {
        width: 60px;
    }
    
    .stats-content {
        padding: 30px 20px;
        margin: 20px;
        min-width: auto;
        max-width: 90vw;
    }
}

/* Animations */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -10px, 0);
    }
    70% {
        transform: translate3d(0, -5px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

.toy-item:hover .toy-icon {
    animation: bounce 1s ease;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(99, 102, 241, 0.1);
    }
    50% {
        box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3);
    }
}

.fidget-panel {
    animation: glow 3s ease-in-out infinite;
}

/* Smooth transitions for all interactive elements */
* {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

button, .toy-item, .control-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}