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

:root {
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: rgba(255, 255, 255, 0.95);
    --text-primary: #333;
    --text-secondary: #666;
    --accent-gradient: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    --stat-gradient: linear-gradient(45deg, #667eea, #764ba2);
    --upgrade-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --button-gradient: linear-gradient(45deg, #4ecdc4, #44a08d);
    --achievement-gradient: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    --achievement-unlocked-gradient: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

body.dark-theme {
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-secondary: rgba(30, 30, 50, 0.95);
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --accent-gradient: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    --stat-gradient: linear-gradient(45deg, #667eea, #764ba2);
    --upgrade-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --button-gradient: linear-gradient(45deg, #4ecdc4, #44a08d);
    --achievement-gradient: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    --achievement-unlocked-gradient: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

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

.game-header {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
}

.game-header h1 {
    font-size: 2.2rem;
    margin-bottom: 12px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.stat {
    background: var(--stat-gradient);
    color: white;
    padding: 12px 20px;
    border-radius: 15px;
    font-size: 1rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.stat-label {
    font-weight: 600;
    margin-right: 10px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
}

.header-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.header-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.header-button:hover::before {
    left: 100%;
}

.achievements-toggle {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.achievements-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.achievements-toggle:hover::before {
    left: 100%;
}

.header-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
    border-color: rgba(255, 255, 255, 0.3);
}

.header-button:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

.achievements-toggle:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.6);
    border-color: rgba(255, 255, 255, 0.3);
}

.achievements-toggle:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(240, 147, 251, 0.4);
}

.theme-toggle {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.theme-toggle:hover::before {
    left: 100%;
}

.theme-toggle:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.6);
    border-color: rgba(255, 255, 255, 0.3);
}

.theme-toggle:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(79, 172, 254, 0.4);
}

.game-main {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-bottom: 20px;
}

.cookie-section {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cookie-button {
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.1s ease;
    margin-bottom: 15px;
}

.cookie-button:hover {
    transform: scale(1.05);
}

.cookie-button:active {
    transform: scale(0.95);
}

.cookie-emoji {
    font-size: 6rem;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
    transition: filter 0.3s ease;
}

.cookie-button:hover .cookie-emoji {
    filter: drop-shadow(0 8px 25px rgba(0, 0, 0, 0.4));
}

.click-info {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 15px;
}

.active-upgrades {
    margin-top: 15px;
    width: 100%;
}

.active-upgrades h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 1rem;
}

.active-upgrades-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.active-upgrade-item {
    background: var(--upgrade-gradient);
    color: white;
    padding: 8px;
    border-radius: 50%;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
    width: 40px;
    height: 40px;
}

.active-upgrade-item:hover {
    transform: translateY(-2px);
}

.active-upgrade-icon {
    font-size: 1.2rem;
}

/* Стили для уведомлений */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-width: 300px;
    word-wrap: break-word;
    animation: slideInRight 0.3s ease;
}

.notification-success {
    background: #4caf50;
    color: white;
}

.notification-error {
    background: #f44336;
    color: white;
}

.notification-info {
    background: #2196f3;
    color: white;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.active-upgrade-count {
    font-weight: bold;
}

.upgrades-section {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.upgrades-section h2 {
    text-align: center;
    margin-bottom: 12px;
    font-size: 1.4rem;
    color: var(--text-primary);
}

.upgrades-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.upgrade-item {
    display: grid;
    grid-template-columns: 50px 1fr 60px 80px;
    gap: 12px;
    align-items: center;
    padding: 15px;
    border-radius: 15px;
    color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Фон для улучшений пассивной генерации */
.upgrade-item.production-upgrade {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-left: 4px solid #4facfe;
}

/* Фон для улучшений кликера */
.upgrade-item.clicker-upgrade {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-left: 4px solid #ff9a9e;
}

.upgrade-item:hover {
    transform: translateY(-2px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover эффект для улучшений пассивной генерации */
.upgrade-item.production-upgrade:hover {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Hover эффект для улучшений кликера */
.upgrade-item.clicker-upgrade:hover {
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.4);
}

.upgrade-icon {
    font-size: 1.5rem;
    text-align: center;
    min-width: 50px;
    max-width: 50px;
}

.upgrade-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
}

.upgrade-name {
    font-size: 1.1rem;
    font-weight: bold;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.upgrade-description {
    font-size: 0.8rem;
    opacity: 0.9;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
}

.upgrade-production {
    font-size: 0.75rem;
    opacity: 0.8;
    color: #4ecdc4;
    font-weight: 600;
}

.upgrade-cost {
    font-size: 0.75rem;
    opacity: 0.8;
}

.upgrade-count {
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
    min-width: 60px;
    max-width: 60px;
    width: 60px;
    box-sizing: border-box;
}

.buy-button {
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    min-width: 80px;
    max-width: 80px;
    font-size: 0.85rem;
    width: 80px;
    box-sizing: border-box;
    white-space: nowrap;
}

/* Кнопка для улучшений пассивной генерации */
.buy-button.production-upgrade {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* Кнопка для улучшений кликера */
.buy-button.clicker-upgrade {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

.buy-button:hover {
    transform: translateY(-2px);
}

/* Hover эффект для кнопок улучшений пассивной генерации */
.buy-button.production-upgrade:hover {
    box-shadow: 0 5px 15px rgba(79, 172, 254, 0.4);
}

/* Hover эффект для кнопок улучшений кликера */
.buy-button.clicker-upgrade:hover {
    box-shadow: 0 5px 15px rgba(255, 154, 158, 0.4);
}

.buy-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.achievements-section {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.achievements-section h2 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 2rem;
    color: var(--text-primary);
}

.achievements-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.achievement {
    background: var(--achievement-gradient);
    padding: 20px;
    border-radius: 15px;
    border-left: 5px solid #ff6b6b;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.achievement:hover {
    transform: translateY(-2px);
}

.achievement.unlocked {
    background: var(--achievement-unlocked-gradient);
    border-left-color: #4ecdc4;
}

.achievement-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.achievement-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Анимации */
@keyframes cookieClick {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.cookie-click-animation {
    animation: cookieClick 0.1s ease;
}

@keyframes achievementUnlock {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.achievement.unlocked {
    animation: achievementUnlock 0.5s ease;
}

/* Адаптивность */
@media (max-width: 768px) {
    .game-main {
        grid-template-columns: 1fr;
    }
    
    .stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .upgrade-item {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 15px;
    }
    
    .cookie-emoji {
        font-size: 6rem;
    }
    
    .game-header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 10px;
    }
    
    .cookie-emoji {
        font-size: 5rem;
    }
    
    .upgrade-item {
        padding: 15px;
    }
}
