/* ============================================
   CLICKER.SU - Основные стили
   ============================================ */

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    overscroll-behavior: none;
    overflow-x: hidden;
}

/* Safe area для iPhone */
.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ============================================
   ЧАСТИЦЫ
   ============================================ */

.particle {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    will-change: transform, opacity;
    user-select: none;
}

/* Всплывающее значение клика */
.click-value {
    position: fixed;
    pointer-events: none;
    z-index: 1001;
    font-weight: bold;
    font-size: 24px;
    text-shadow: 0 0 5px rgba(0,0,0,0.8), 0 0 10px rgba(255,215,0,0.5);
    animation: floatUp 0.8s ease-out forwards;
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-80px) scale(1.3); }
}

/* Критический урон - большой текст */
.click-value.critical {
    font-size: 40px;
    animation: floatUpCritical 1s ease-out forwards;
}

@keyframes floatUpCritical {
    0% { opacity: 1; transform: translateY(0) scale(0.5) rotate(-10deg); }
    20% { transform: translateY(-20px) scale(1.5) rotate(5deg); }
    100% { opacity: 0; transform: translateY(-120px) scale(1) rotate(0deg); }
}

/* ============================================
   КНОПКА КЛИКЕРА
   ============================================ */

/* Пульсация кнопки */
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(168, 85, 247, 0.4); }
    50% { box-shadow: 0 0 40px rgba(168, 85, 247, 0.8), 0 0 60px rgba(168, 85, 247, 0.4); }
}

.clicker-btn {
    animation: pulse 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Ripple эффект при клике */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.4) 0%, transparent 70%);
    pointer-events: none;
    animation: rippleAnim 0.6s ease-out forwards;
}

@keyframes rippleAnim {
    from { transform: scale(0); opacity: 1; }
    to { transform: scale(4); opacity: 0; }
}

/* ============================================
   COMBO СИСТЕМА
   ============================================ */

/* Combo эффект на кнопке */
@keyframes comboGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(168, 85, 247, 0.4); }
    50% { box-shadow: 0 0 60px rgba(251, 146, 60, 0.8), 0 0 100px rgba(239, 68, 68, 0.6); }
}

.combo-active {
    animation: comboGlow 0.3s ease-in-out infinite !important;
    border-color: #f97316 !important;
}

/* Супер комбо - ещё более интенсивный эффект */
@keyframes superComboGlow {
    0%, 100% {
        box-shadow: 0 0 30px rgba(239, 68, 68, 0.6), 0 0 60px rgba(251, 146, 60, 0.4);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 0 80px rgba(239, 68, 68, 1), 0 0 120px rgba(251, 146, 60, 0.8), 0 0 160px rgba(234, 179, 8, 0.6);
        filter: brightness(1.2);
    }
}

.super-combo-active {
    animation: superComboGlow 0.2s ease-in-out infinite !important;
    border-color: #ef4444 !important;
}

/* Combo counter */
.combo-display {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(251, 146, 60, 0.8);
    animation: comboPulse 0.5s ease-in-out infinite;
    z-index: 50;
}

@keyframes comboPulse {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.1); }
}

/* Огненные частицы для комбо */
@keyframes fireParticle {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-100px) scale(0.3); opacity: 0; }
}

.fire-particle {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    font-size: 24px;
    animation: fireParticle 0.8s ease-out forwards;
}

/* ============================================
   ЭФФЕКТЫ КЛИКОВ
   ============================================ */

/* Lucky click эффект */
@keyframes lucky {
    0% { filter: brightness(1); }
    50% { filter: brightness(2) hue-rotate(30deg); }
    100% { filter: brightness(1); }
}

.lucky-effect {
    animation: lucky 0.3s ease-out;
}

/* Shake эффект */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px) rotate(-2deg); }
    40% { transform: translateX(8px) rotate(2deg); }
    60% { transform: translateX(-6px) rotate(-1deg); }
    80% { transform: translateX(6px) rotate(1deg); }
}

.shake {
    animation: shake 0.4s ease-out;
}

/* Mega click эффект */
@keyframes megaBurst {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.15); filter: brightness(1.5) saturate(1.5); }
    100% { transform: scale(1); filter: brightness(1); }
}

.mega-burst {
    animation: megaBurst 0.3s ease-out;
}

/* ============================================
   ЗАГОЛОВОК
   ============================================ */

/* Радужный заголовок */
@keyframes rainbow {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

.rainbow-text {
    animation: rainbow 3s linear infinite;
}

/* Светящийся заголовок при комбо */
@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(168, 85, 247, 0.5); }
    50% { text-shadow: 0 0 40px rgba(251, 146, 60, 0.8), 0 0 60px rgba(239, 68, 68, 0.5); }
}

.title-glow {
    animation: titleGlow 0.5s ease-in-out infinite;
}

/* ============================================
   АНИМАЦИИ УРОВНЕЙ И НАГРАД
   ============================================ */

/* Анимация повышения уровня */
@keyframes levelUp {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); filter: brightness(1.5); }
    100% { transform: scale(1); }
}

.level-up {
    animation: levelUp 0.6s ease-out;
}

/* Золотой дождь при награде */
@keyframes goldRain {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.gold-rain {
    position: fixed;
    pointer-events: none;
    z-index: 999;
    font-size: 30px;
    animation: goldRain 2s linear forwards;
}

/* Монета летит к счётчику */
@keyframes coinFly {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.coin-fly {
    position: fixed;
    pointer-events: none;
    z-index: 1002;
    font-size: 20px;
}

/* Эффект на счётчике монет */
#coins-display {
    transition: transform 0.1s ease-out;
}

.scale-125 {
    transform: scale(1.25);
}

/* ============================================
   UI ЭЛЕМЕНТЫ
   ============================================ */

/* Свечение для доступных апгрейдов */
.upgrade-available {
    border-color: rgba(34, 197, 94, 0.6) !important;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.3);
}

/* Переключатель */
.toggle {
    appearance: none;
    width: 48px;
    height: 24px;
    background: #374151;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle:checked {
    background: #a855f7;
}

.toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle:checked::after {
    transform: translateX(24px);
}

/* Плавное появление секций */
.section {
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Активная навигация */
.nav-btn.active {
    background: rgba(168, 85, 247, 0.2);
}

/* Скрыть скроллбар */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ============================================
   УВЕДОМЛЕНИЯ
   ============================================ */

.notification {
    animation: slideIn 0.3s ease-out, slideOut 0.3s ease-in 2.7s;
}

@keyframes slideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-100%); opacity: 0; }
}

/* Особое уведомление для достижений */
.notification.achievement {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.9), rgba(251, 146, 60, 0.9)) !important;
    border: 2px solid #fbbf24;
}

/* ============================================
   ЭКРАН ЗАГРУЗКИ
   ============================================ */

.loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(to bottom, #111827, #1e1b4b, #111827);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

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

.loading-icon {
    animation: loadingPulse 1s ease-in-out infinite;
}

@keyframes loadingBar {
    0% { width: 0%; }
    100% { width: 100%; }
}

.loading-bar {
    animation: loadingBar 1.5s ease-out forwards;
}

/* ============================================
   СКИНЫ КНОПКИ (бонус)
   ============================================ */

.clicker-btn.skin-fire {
    border-color: #ef4444 !important;
    background: linear-gradient(135deg, #7f1d1d, #991b1b, #b91c1c) !important;
}

.clicker-btn.skin-ice {
    border-color: #38bdf8 !important;
    background: linear-gradient(135deg, #0c4a6e, #075985, #0369a1) !important;
}

.clicker-btn.skin-gold {
    border-color: #fbbf24 !important;
    background: linear-gradient(135deg, #78350f, #92400e, #b45309) !important;
}

.clicker-btn.skin-neon {
    border-color: #22d3ee !important;
    background: linear-gradient(135deg, #134e4a, #115e59, #0f766e) !important;
    box-shadow: 0 0 30px rgba(34, 211, 238, 0.5), inset 0 0 20px rgba(34, 211, 238, 0.2) !important;
}

/* ============================================
   ЭФФЕКТ ЭКРАНА ПРИ MILESTONE
   ============================================ */

@keyframes screenFlash {
    0% { opacity: 0; }
    50% { opacity: 0.3; }
    100% { opacity: 0; }
}

.screen-flash {
    position: fixed;
    inset: 0;
    background: white;
    pointer-events: none;
    z-index: 9998;
    animation: screenFlash 0.3s ease-out forwards;
}

/* Конфетти */
@keyframes confetti {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

.confetti {
    position: fixed;
    pointer-events: none;
    z-index: 999;
    font-size: 24px;
    animation: confetti 3s linear forwards;
}
