/* Wcześniejszy kod CSS pozostaje bez zmian do linii 100 */
:root {
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --text-main: #f5f5f5;
    --text-muted: #a0a0a0;
    --butter-primary: #ffc107;
    --butter-glow: rgba(255, 193, 7, 0.4);
    --butter-dark: #ffb300;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-touch-callout: none; /* iOS Safari context menu */
    -webkit-user-select: none; /* Safari text selection */
    -khtml-user-select: none; /* Konqueror HTML */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE/Edge */
    user-select: none; /* Chrome, Edge, Opera and Firefox */
    -webkit-user-drag: none; /* Zapobiega przeciąganiu elementów */
}

/* Zabezpieczenie przed niechcianym zoomem na podwójne kliknięcie (szczególnie iOS) */
body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden; /* Brak przewijania */
    touch-action: manipulation;
    overscroll-behavior-y: none; /* Zapobiega odświeżaniu strony (pull-to-refresh) na urządzeniach mobilnych */
}

.game-container {
    display: none; /* Domyślnie ukryte, pokazane tylko po instalacji */
    flex-direction: column;
    height: 100vh;
    width: 100%;
    background-color: var(--bg-panel);
    overflow: hidden;
}

.install-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    text-align: center;
    padding: 2rem;
}

.install-overlay h1 {
    color: var(--butter-primary);
    margin-bottom: 0.5rem;
}

.install-overlay p {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.5;
}

.install-btn {
    background: var(--butter-primary);
    color: var(--text-dark);
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 12px;
    margin-top: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
    font-family: 'Outfit', sans-serif;
}

/* Kiedy aplikacja jest uruchomiona po instalacji na ekranie głównym */
@media all and (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
    .install-overlay {
        display: none !important;
    }
    .game-container {
        display: flex !important;
    }
    .reset-pwa-btn {
        display: none !important;
    }
}

.offline-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(18, 18, 18, 0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    text-align: center;
    padding: 2rem;
    backdrop-filter: blur(5px);
}

.offline-overlay h1 {
    color: var(--butter-primary);
    margin-bottom: 0.5rem;
    font-size: 2.2rem;
}

.offline-overlay p {
    color: var(--text-main);
    font-size: 1.2rem;
    line-height: 1.5;
    margin-bottom: 2rem;
}

.clicker-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
    background: radial-gradient(circle at center, #2a2a2a 0%, var(--bg-panel) 100%);
    box-shadow: 0 5px 25px rgba(0,0,0,0.6);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.clicker-section.compact-mode {
    padding: 1rem;
}

.clicker-section.compact-mode .score-board {
    margin-bottom: 0;
}

.clicker-section.compact-mode .score-board p {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding: 0;
}

.score-board {
    text-align: center;
    margin-bottom: 2rem;
    z-index: 5;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-board h1 {
    font-size: 2.5rem;
    font-weight: 900;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.clicker-section.compact-mode .score-board h1 {
    font-size: 2rem;
}

.score-highlight {
    color: var(--butter-primary);
    text-shadow: 0 0 15px var(--butter-glow);
}

.score-board p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    max-height: 30px;
    opacity: 1;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#click-power-display {
    font-size: 0.9rem;
    color: var(--butter-primary);
    opacity: 0.8;
}

.butter-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 220px;
    height: 220px;
    z-index: 10;
    transform-origin: top center;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.clicker-section.compact-mode .butter-container {
    height: 0;
    opacity: 0;
    transform: scale(0.5) translateY(-50px);
    pointer-events: none;
    margin: 0;
}

#butter {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
    filter: drop-shadow(0 15px 25px rgba(255, 193, 7, 0.2));
    transition: transform 0.05s ease-out, filter 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#butter:active {
    transform: scale(0.92);
    filter: drop-shadow(0 10px 15px rgba(255, 193, 7, 0.1));
}

/* Filtry dla modyfikacji skinów, które przekroczyły limit API AI :) */
img.skin-filter-4, #butter.skin-filter-4 { filter: hue-rotate(90deg) saturate(3) brightness(1.2) drop-shadow(0 15px 25px rgba(0, 255, 50, 0.2)); } /* Uran */
img.skin-filter-5, #butter.skin-filter-5 { filter: hue-rotate(330deg) saturate(3) brightness(0.9) drop-shadow(0 15px 25px rgba(255, 50, 0, 0.2)); } /* Magma */
img.skin-filter-6, #butter.skin-filter-6 { filter: hue-rotate(180deg) saturate(2) brightness(1.5) drop-shadow(0 15px 25px rgba(0, 200, 255, 0.2)); } /* Plazma */
img.skin-filter-7, #butter.skin-filter-7 { filter: hue-rotate(270deg) saturate(3) contrast(1.5) drop-shadow(0 15px 25px rgba(200, 0, 255, 0.2)); } /* Tęcza/Fiolet */
img.skin-filter-8, #butter.skin-filter-8 { filter: hue-rotate(220deg) brightness(0.4) contrast(2) drop-shadow(0 15px 25px rgba(0, 0, 0, 0.4)); } /* Mrok */
img.skin-filter-9, #butter.skin-filter-9 { filter: hue-rotate(120deg) contrast(2) saturate(5) drop-shadow(0 0 10px #0f0) drop-shadow(0 15px 25px rgba(0, 255, 0, 0.2)); } /* Kwantowe */
img.skin-filter-10, #butter.skin-filter-10 { filter: brightness(2) saturate(2) drop-shadow(0 0 20px #ff0) drop-shadow(0 15px 25px rgba(255, 255, 0, 0.2)); } /* Ostateczne */

/* Ochrona dla active kiedy filtr jest zdefiniowany jako dodatkowa klasa */
#butter.skin-filter-4:active { transform: scale(0.92); filter: hue-rotate(90deg) saturate(3) brightness(1.2) drop-shadow(0 10px 15px rgba(0, 255, 50, 0.1)); }
#butter.skin-filter-5:active { transform: scale(0.92); filter: hue-rotate(330deg) saturate(3) brightness(0.9) drop-shadow(0 10px 15px rgba(255, 50, 0, 0.1)); }
#butter.skin-filter-6:active { transform: scale(0.92); filter: hue-rotate(180deg) saturate(2) brightness(1.5) drop-shadow(0 10px 15px rgba(0, 200, 255, 0.1)); }
#butter.skin-filter-7:active { transform: scale(0.92); filter: hue-rotate(270deg) saturate(3) contrast(1.5) drop-shadow(0 10px 15px rgba(200, 0, 255, 0.1)); }
#butter.skin-filter-8:active { transform: scale(0.92); filter: hue-rotate(220deg) brightness(0.4) contrast(2) drop-shadow(0 10px 15px rgba(0, 0, 0, 0.2)); }
#butter.skin-filter-9:active { transform: scale(0.92); filter: hue-rotate(120deg) contrast(2) saturate(5) drop-shadow(0 0 10px #0f0) drop-shadow(0 10px 15px rgba(0, 255, 0, 0.1)); }
#butter.skin-filter-10:active { transform: scale(0.92); filter: brightness(2) saturate(2) drop-shadow(0 0 20px #ff0) drop-shadow(0 10px 15px rgba(255, 255, 0, 0.1)); }


/* Floating text animation */
.floating-text {
    position: absolute;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--butter-primary);
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
    pointer-events: none;
    animation: floatUp 0.8s ease-out forwards;
    z-index: 20;
}

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

/* Dolna sekcja */
.scrollable-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: 3rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: none;
}

.upgrades-section {
    width: 100%;
    padding: 1.5rem 1rem 0 1rem;
    display: flex;
    flex-direction: column;
}

.upgrades-section h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--butter-primary);
    text-align: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.8rem;
}

.section-desc {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.upgrades-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.upgrade-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.1s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    -webkit-tap-highlight-color: transparent;
}

.upgrade-card:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
}

.swap-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.swap-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.9);
}

.upgrade-card.disabled {
    opacity: 0.5;
    filter: grayscale(100%);
}

.upgrade-card.locked {
    display: none;
}

.upgrade-card.purchased {
    border-color: var(--butter-primary);
    background: rgba(255, 193, 7, 0.1);
    opacity: 0.8;
}

.upgrade-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.upgrade-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

#bet-amount {
    background: rgba(0,0,0,0.5);
    border: 2px solid rgba(255, 193, 7, 0.5);
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-size: 1.2rem;
    font-family: 'Outfit', sans-serif;
    width: 60%;
    text-align: center;
    outline: none;
    transition: 0.2s;
}

#bet-amount:focus {
    border-color: var(--butter-primary);
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.3);
}

.upgrade-cost {
    font-weight: bold;
    color: var(--butter-primary);
    font-size: 1.1rem;
    margin-top: 0.2rem;
}

.upgrade-count {
    font-size: 1.5rem;
    font-weight: 900;
    color: rgba(255,255,255,0.2);
    margin-left: 1rem;
}

@keyframes lava-pulse {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.3); }
}

.app-container {
    padding-bottom: 60px; /* Miejsce na reklamę AdSense */
}


/* --- MODERN UI DLA GIER --- */
.game-card {
    background: linear-gradient(145deg, rgba(30, 30, 40, 0.8), rgba(20, 20, 25, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.game-title {
    font-size: 1.6rem;
    color: #ffc107;
    margin-bottom: 10px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.game-btn {
    background: linear-gradient(135deg, #ffaa00, #ff6a00);
    color: #fff;
    border: none;
    padding: 12px 25px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 170, 0, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 15px;
    text-transform: uppercase;
}

.game-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 5px rgba(255, 170, 0, 0.4);
}

.game-canvas-container {
    position: relative;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    margin-top: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    box-shadow: inset 0 5px 15px rgba(0,0,0,0.8);
    touch-action: none;
}

.dex-btn {
    width: 100%;
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white;
    border: none;
    padding: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 15px;
    margin-bottom: 3rem;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    cursor: pointer;
    transition: transform 0.2s;
}

.dex-btn:active {
    transform: scale(0.95);
}
