/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: rgba(255, 255, 255, 0.1);
    --bg-secondary: rgba(255, 255, 255, 0.05);
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent-color: rgba(255, 107, 107, 0.9);
    --shadow-light: 0 8px 32px rgba(255, 255, 255, 0.1);
    --shadow-dark: 0 8px 32px rgba(0, 0, 0, 0.2);
    --border-color: rgba(255, 255, 255, 0.2);
    --blur-strength: 20px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #667eea;
    min-height: 100vh;
    overflow: hidden;
    color: var(--text-primary);
    position: relative;
}


/* Canvas - full viewport */
#gameCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    cursor: crosshair;
    z-index: 0;
}

/* Game title - subtle and only when not active */
.game-title {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 80;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.game-title h1 {
    font-size: 2.8rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 8px 0;
}

.game-title p {
    font-size: 0.9rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
}

/* Welcome message - only visible when nothing else is shown */
.fade-message {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text-primary);
    text-align: center;
    z-index: 100;
    opacity: 1;
    pointer-events: none;
}

@keyframes welcomeFade {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

.fade-message #exerciseIndicator {
    display: block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 8px;
    font-style: italic;
}

/* Progress bar - always visible at bottom */
.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--bg-secondary);
    backdrop-filter: blur(var(--blur-strength));
    border-top: 1px solid var(--border-color);
    z-index: 90;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--accent-color), rgba(255, 152, 0, 0.8));
    transition: width 0.3s ease;
    transform-origin: left;
}

.progress-text {
    position: absolute;
    top: -30px;
    right: 10px;
    background: var(--bg-primary);
    backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: var(--shadow-light), var(--shadow-dark);
}

/* Highlighted progress bar when countdown active */
.progress-bar.countdown-active .progress-fill {
    background: linear-gradient(90deg, var(--accent-color), rgba(244, 67, 54, 0.9));
    animation: progressPulse 1s ease-in-out infinite alternate;
}

.progress-bar.countdown-active .progress-text {
    background: var(--accent-color);
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.95);
    animation: pulse 1s ease-in-out infinite alternate;
}

@keyframes progressPulse {
    from { filter: brightness(1); }
    to { filter: brightness(1.2); }
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

/* Coffee support icon - matches settings gear exactly */
.coffee-support {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 90;
    cursor: pointer;
    background: var(--bg-primary);
    backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    color: var(--text-secondary);
    box-shadow: var(--shadow-light), var(--shadow-dark);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.coffee-support:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-light), 0 6px 20px rgba(0, 0, 0, 0.2);
}

.coffee-hint {
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.8;
}

.coffee-support svg {
    transition: transform 0.3s ease;
}

.coffee-support:hover svg {
    transform: scale(1.1);
}

/* Settings gear icon - always visible */
.settings-gear {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 90;
    cursor: pointer;
    background: var(--bg-primary);
    backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    color: var(--text-secondary);
    box-shadow: var(--shadow-light), var(--shadow-dark);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-gear:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    box-shadow: var(--shadow-light), 0 6px 20px rgba(0, 0, 0, 0.2);
}

.gear-hint {
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.8;
}

.settings-gear svg {
    transition: transform 0.3s ease;
}

.settings-gear:hover svg {
    transform: rotate(90deg);
}

/* Post-game results panel */
.results-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    visibility: hidden;
    z-index: 200;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.results-panel.visible {
    opacity: 1;
    visibility: visible;
}

.results-content {
    background: var(--bg-primary);
    backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px 40px;
    text-align: center;
    box-shadow: var(--shadow-light), var(--shadow-dark);
    min-width: 300px;
}

.results-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.stat-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.play-again {
    margin-top: 24px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Settings panel */
.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    visibility: hidden;
    z-index: 300;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-panel.visible {
    opacity: 1;
    visibility: visible;
}

.settings-content {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 28px 32px;
    box-shadow: var(--shadow-light), var(--shadow-dark);
    min-width: 320px;
}

.settings-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
    color: rgba(0, 0, 0, 0.9);
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.7);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.size-options,
.duration-options,
.exercise-options {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.size-btn,
.duration-btn,
.exercise-btn {
    background: rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(var(--blur-strength));
    color: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.size-btn:hover,
.duration-btn:hover,
.exercise-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.9);
    border-color: rgba(0, 0, 0, 0.3);
}

.size-btn.active,
.duration-btn.active,
.exercise-btn.active {
    background: var(--accent-color);
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.4);
}


.settings-hint {
    margin-top: 16px;
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.6);
    text-align: center;
    line-height: 1.4;
    opacity: 0.8;
}

/* Game states */
.game-active .game-title {
    opacity: 0;
}

.game-active #welcomeMessage {
    display: none;
}

.game-active .coffee-support {
    opacity: 0;
    pointer-events: none;
}

.game-active .results-panel {
    display: none;
}

.game-active .settings-panel {
    display: none;
}

/* Hide welcome message when other panels are visible */
.results-panel.visible ~ #welcomeMessage,
.settings-panel.visible ~ #welcomeMessage {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .game-title {
        top: 20px;
    }
    
    .game-title h1 {
        font-size: 2.2rem;
    }
    
    .game-title p {
        font-size: 0.8rem;
    }
    
    .fade-message {
        font-size: 1.2rem;
        padding: 0 20px;
    }
    
    .settings-gear {
        top: 15px;
        right: 15px;
        padding: 8px;
    }
    
    .gear-hint {
        display: none;
    }
    
    .progress-text {
        right: 15px;
        font-size: 0.8rem;
        padding: 3px 6px;
    }
    
    .coffee-support {
        bottom: 15px;
        left: 15px;
        padding: 8px;
    }
    
    .coffee-hint {
        display: none;
    }
    
    .results-content {
        margin: 20px;
        padding: 24px 28px;
        min-width: 280px;
    }
    
    .results-content h2 {
        font-size: 1.3rem;
    }
    
    .stat-value {
        font-size: 1.7rem;
    }
    
    .settings-content {
        margin: 20px;
        padding: 24px 28px;
        min-width: 280px;
    }
    
    .size-options,
    .duration-options {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .game-title {
        top: 15px;
    }
    
    .game-title h1 {
        font-size: 1.8rem;
    }
    
    .game-title p {
        font-size: 0.75rem;
    }
    
    .settings-gear {
        top: 10px;
        right: 10px;
        padding: 6px;
    }
    
    .progress-text {
        right: 10px;
        font-size: 0.75rem;
        padding: 2px 5px;
    }
    
    .coffee-support {
        bottom: 10px;
        left: 10px;
        padding: 6px;
    }
}

/* Drag & Drop specific styling */
.file-icon {
    /* Visual styling for draggable files is handled in canvas rendering */
    cursor: grab;
}

.file-icon.dragging {
    cursor: grabbing;
}

.folder-target {
    /* Visual styling for drop folders is handled in canvas rendering */
}

.drag-preview {
    /* Drag preview effects are handled in canvas rendering with opacity and highlighting */
}

/* Canvas cursor states for drag & drop mode */
body.game-active #gameCanvas {
    cursor: default;
}

body.game-active.dragging #gameCanvas {
    cursor: grabbing;
}

/* Version display - lower right corner */
.version-display {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 85;
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    user-select: none;
}

/* Additional responsive styles for exercise options */
@media (max-width: 768px) {
    .exercise-options {
        flex-wrap: wrap;
    }
    
    .exercise-btn {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
    
    .version-display {
        bottom: 12px;
        right: 12px;
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .exercise-options {
        flex-direction: column;
        gap: 6px;
    }
    
    .exercise-btn {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    .version-display {
        bottom: 10px;
        right: 10px;
        font-size: 0.6rem;
    }
}