/* ========================================================
   DINUŚ 3D - NOWOCZESNY DESIGN DLA DZIECI
   I PEŁNA RESPONSYWNOŚĆ NA SMARTFONY I PC
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@700;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #1A1A24;
    font-family: 'Nunito', sans-serif;
    color: #FFFFFF;
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ========================================================
   HUD
   ======================================================== */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 16px 20px;
    display: none;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 10;
}

.hud-pill {
    background: rgba(20, 20, 30, 0.75);
    backdrop-filter: blur(8px);
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-radius: 30px;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.25rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

#hud-hearts {
    font-size: 1.5rem;
    letter-spacing: 4px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

#hud-coins {
    color: #FFD700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#level-name-display {
    font-family: 'Fredoka One', cursive;
    font-size: 1.25rem;
    color: #FFF9C4;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

#tool-hint-text {
    font-size: 0.95rem;
    color: #80D8FF;
    font-weight: 900;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 12px;
    border-radius: 12px;
}

#hud-buff-timer {
    display: none;
    background: linear-gradient(135deg, #FF6F00, #FFD54F);
    color: #212121;
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    padding: 6px 14px;
    border-radius: 20px;
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 16px #FFD54F;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1.0); }
    100% { transform: scale(1.08); }
}

/* ========================================================
   STEROWANIE MOBILNE
   ======================================================== */
#mobile-controls {
    position: absolute;
    bottom: 24px;
    left: 0;
    width: 100%;
    display: none;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 32px;
    pointer-events: none;
    z-index: 15;
}

#joystick-zone {
    width: 130px;
    height: 130px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, rgba(0, 0, 0, 0.45) 80%);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

#joystick-thumb {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4CAF50, #81C784);
    border: 3px solid #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: transform 0.05s ease-out;
}

#attack-btn {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #FF5722, #FF8A65);
    border: 4px solid #FFFFFF;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #FFFFFF;
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    box-shadow: 0 8px 24px rgba(255, 87, 34, 0.5);
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.1s ease;
}

#attack-btn:active {
    transform: scale(0.9);
}

#attack-btn .btn-icon {
    font-size: 1.8rem;
}

/* ========================================================
   MODALE / EKRANY
   ======================================================== */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 20, 0.88);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    padding: 16px;
}

.modal-content {
    background: #252836;
    border: 4px solid #4CAF50;
    border-radius: 32px;
    padding: 24px;
    max-width: 580px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.modal-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2.2rem;
    color: #FFF176;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}

.modal-desc {
    font-size: 1.05rem;
    color: #E0E0E0;
    line-height: 1.4;
}

.game-btn {
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: #FFFFFF;
    border: 3px solid #FFFFFF;
    border-radius: 24px;
    padding: 12px 24px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.4);
    transition: transform 0.15s ease, filter 0.15s ease;
    width: 80%;
    max-width: 280px;
}

.game-btn:hover {
    transform: translateY(-2px) scale(1.03);
    filter: brightness(1.1);
}

.game-btn:active {
    transform: translateY(2px) scale(0.98);
}

.game-btn-secondary {
    background: linear-gradient(135deg, #0288D1, #29B6F6);
    box-shadow: 0 8px 20px rgba(2, 136, 209, 0.4);
}

.game-btn-orange {
    background: linear-gradient(135deg, #F57C00, #FFA726);
    box-shadow: 0 8px 20px rgba(245, 124, 0, 0.4);
}

/* ========================================================
   KAFELKI WYBORU ŚWIATÓW (BIOMÓW)
   ======================================================== */
.worlds-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

.world-card {
    background: #1E212B;
    border: 3px solid #37474F;
    border-radius: 20px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.world-card:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: #FFF176;
    box-shadow: 0 6px 16px rgba(255, 241, 118, 0.3);
}

.world-card.active-world {
    border-color: #4CAF50;
    background: #2E3842;
}

.world-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.world-card-icon {
    font-size: 2.2rem;
}

.world-card-name {
    font-family: 'Fredoka One', cursive;
    font-size: 1.15rem;
    color: #FFF9C4;
}

.world-card-desc {
    font-size: 0.8rem;
    color: #B0BEC5;
}

.world-card-play {
    background: #4CAF50;
    color: #FFFFFF;
    font-family: 'Fredoka One', cursive;
    border: none;
    border-radius: 14px;
    padding: 8px 16px;
    font-size: 0.95rem;
    cursor: pointer;
}

/* Siatka poziomów */
.level-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    width: 100%;
    padding: 6px 0;
    max-height: 180px;
    overflow-y: auto;
}

.level-btn {
    aspect-ratio: 1;
    border-radius: 14px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.1s ease;
    border: 2px solid #FFFFFF;
}

.level-btn.unlocked {
    background: linear-gradient(135deg, #4CAF50, #81C784);
    color: #FFFFFF;
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.4);
}

.level-btn.locked {
    background: #37474F;
    color: #78909C;
    border-color: #546E7A;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Sklep */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px;
}

.shop-card {
    background: #1E212B;
    border: 2px solid #37474F;
    border-radius: 20px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.shop-icon {
    font-size: 2.2rem;
}

.shop-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.05rem;
    color: #FFF9C4;
}

.shop-desc {
    font-size: 0.8rem;
    color: #B0BEC5;
    text-align: center;
}

.shop-price {
    font-weight: 900;
    color: #FFD700;
    font-size: 0.95rem;
}

.shop-buy-btn {
    background: #4CAF50;
    border: none;
    color: #FFFFFF;
    padding: 6px 14px;
    border-radius: 12px;
    font-family: 'Fredoka One', cursive;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 4px;
}

.shop-buy-btn.owned {
    background: #0288D1;
}

.chest-card {
    background: #1E212B;
    border: 3px solid #FFD700;
    border-radius: 24px;
    padding: 18px;
    width: 100%;
    margin: 8px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: rewardPop 0.5s ease-out;
}

@keyframes rewardPop {
    0% { transform: scale(0.7); opacity: 0; }
    80% { transform: scale(1.05); }
    100% { transform: scale(1.0); opacity: 1; }
}

.rarity-tag {
    font-family: 'Fredoka One', cursive;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.rarity-common { background: #455A64; color: #ECEFF1; }
.rarity-rare { background: #7B1FA2; color: #F3E5F5; }
.rarity-epic { background: #E65100; color: #FFF8E1; box-shadow: 0 0 10px #FF9800; }

#mute-btn {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 60;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.3rem;
    cursor: pointer;
}

@media (max-width: 600px) {
    .modal-content {
        padding: 18px 14px;
        max-height: 94vh;
    }
    .modal-title {
        font-size: 1.8rem;
    }
    .level-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    #mobile-controls {
        bottom: 16px;
        padding: 0 20px;
    }
}
