/* Global Styles */
:root {
    /* Colors */
    --primary: #667eea;
    --primary-dark: #764ba2;
    --secondary: #f093fb;
    --success: #38ef7d;
    --danger: #ff6b6b;
    --warning: #ffd93d;
    --info: #4ecdc4;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-danger: linear-gradient(135deg, #ee5a6f 0%, #f093fb 100%);
    --gradient-bg: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
    
    /* Spacing */
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 15px;
    --spacing-lg: 20px;
    --spacing-xl: 30px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.4);
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--gradient-bg);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    color: white;
    user-select: none;
    -webkit-user-select: none;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hide {
    opacity: 0;
    visibility: hidden;
}

.loader-container {
    text-align: center;
}

.loader {
    width: 80px;
    height: 80px;
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-top: 6px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loader-container h2 {
    font-size: 2em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.loader-container p {
    font-size: 1.2em;
    opacity: 0.8;
}

/* Main Menu */
.main-menu {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.menu-container {
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.game-title {
    font-size: 3.5em;
    font-weight: 900;
    margin-bottom: 10px;
    text-shadow: 3px 3px 12px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

.title-icon {
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.subtitle {
    font-size: 1.3em;
    opacity: 0.9;
    margin-bottom: 40px;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
}

/* Menu Buttons */
.menu-buttons {
    display: grid;
    gap: 15px;
    margin-bottom: 40px;
}

.menu-btn {
    padding: 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.menu-btn:hover, .menu-btn:active {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.menu-btn.primary {
    background: var(--gradient-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

.menu-btn.challenge {
    background: var(--gradient-danger);
    border-color: rgba(255, 255, 255, 0.3);
}

.menu-btn.puzzle {
    background: var(--gradient-success);
    border-color: rgba(255, 255, 255, 0.3);
}

.menu-btn.expert {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-icon {
    font-size: 1.3em;
}

/* Menu Stats */
.menu-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Menu Footer */
.menu-footer {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.settings-btn, .how-to-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all var(--transition-normal);
}

.settings-btn:hover, .how-to-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* Game Screen */
.game-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Game Header */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.back-btn, .sound-btn {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.3em;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:active, .sound-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

.header-info {
    text-align: center;
    flex: 1;
}

.mode-badge {
    display: inline-block;
    padding: 5px 15px;
    background: var(--gradient-primary);
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    margin-bottom: 5px;
    box-shadow: var(--shadow-sm);
}

.level-display {
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-icon {
    font-size: 1.5em;
}

.stat-text {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.7em;
    opacity: 0.8;
}

.stat-value {
    font-size: 1.1em;
    font-weight: bold;
}

/* Game Board */
.game-board {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.bottles-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 15px;
    max-width: 800px;
    width: 100%;
    padding: 10px;
}

/* Game Controls */
.game-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.control-btn {
    padding: 12px;
    border: none;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    position: relative;
}

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

.control-btn:not(:disabled):active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.25);
}

.control-btn.hint {
    background: var(--gradient-success);
}

.btn-text {
    font-size: 0.85em;
}

.btn-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: var(--shadow-sm);
}

/* Progress Bar */
.progress-container {
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.progress-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-success);
    transition: width 0.5s ease;
    border-radius: 5px;
}

.progress-text {
    text-align: center;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5em;
    }
    
    .menu-btn {
        font-size: 1.1em;
        padding: 15px;
    }
    
    .menu-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        font-size: 2em;
    }
    
    .stat-value {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2em;
    }
    
    .bottles-container {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        gap: 10px;
    }
    
    .game-controls {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        padding: 10px;
    }
    
    .control-btn {
        padding: 10px 5px;
        font-size: 0.85em;
    }
    
    .btn-icon {
        font-size: 1.3em;
    }
    
    .btn-text {
        font-size: 0.75em;
    }
}