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

:root {
    --primary-green: #4caf50;
    --dark-green: #2e7d32;
    --light-green: #81c784;
    --grass-bg: #8bc34a;
    --accent-yellow: #fbc02d;
    --accent-orange: #ff9800;
    --accent-red: #e53935;
    --wood-border: #795548;
    --wood-shadow: #4e342e;
    --ui-cream: #fffde7;
    --text-dark: #263238;
}

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

body {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    background: radial-gradient(circle at center, #aed581 0%, #7cb342 60%, #558b2f 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    overflow-x: hidden;
    padding: 10px;
}

/* Główny kontener gry */
.game-wrapper {
    position: relative;
    width: 100%;
    max-width: 920px;
    background: #dcedc8;
    border-radius: 24px;
    padding: 16px;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
    border: 6px solid #689f38;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Górny pasek HUD */
.hud-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border-radius: 16px;
    padding: 10px 18px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    gap: 8px;
}

.hud-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.hud-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.15rem;
    font-weight: 700;
    background: #f1f8e9;
    padding: 6px 14px;
    border-radius: 20px;
    border: 2px solid #c5e1a5;
    color: var(--dark-green);
}

.hud-badge .icon {
    font-size: 1.35rem;
}

.hud-badge.combo {
    background: #fff9c4;
    border-color: #fbc02d;
    color: #e65100;
    animation: pulseCombo 0.8s infinite alternate ease-in-out;
}

@keyframes pulseCombo {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

.hud-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Przyciski w grze */
.btn-ui {
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 8px 16px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    background: #81c784;
    color: #ffffff;
    box-shadow: 0 4px #388e3c;
    transition: all 0.1s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-ui:hover {
    background: #66bb6a;
    transform: translateY(-2px);
    box-shadow: 0 6px #2e7d32;
}

.btn-ui:active {
    transform: translateY(2px);
    box-shadow: 0 2px #2e7d32;
}

.btn-ui.muted {
    background: #b0bec5;
    box-shadow: 0 4px #78909c;
}

.btn-ui.btn-primary {
    background: #ffb74d;
    box-shadow: 0 4px #f57c00;
    color: #3e2723;
}
.btn-ui.btn-primary:hover {
    background: #ffa726;
    box-shadow: 0 6px #e65100;
}

/* Obszar płótna Canvas */
.canvas-container {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    background: #7cb342;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.2);
    border: 4px solid #558b2f;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* Panele nakładkowe (Modale / Menu) */
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(46, 125, 50, 0.78);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
    border-radius: 18px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 28px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    border: 5px solid #81c784;
}

.modal-card h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--dark-green);
    margin-bottom: 12px;
}

.modal-card p {
    font-size: 1.1rem;
    color: #546e7a;
    line-height: 1.5;
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.btn-big {
    font-family: inherit;
    font-size: 1.25rem;
    font-weight: 800;
    padding: 14px 24px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 6px rgba(0, 0, 0, 0.2);
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-big:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px rgba(0, 0, 0, 0.25);
}

.btn-big:active {
    transform: translateY(3px);
    box-shadow: 0 2px rgba(0, 0, 0, 0.2);
}

.btn-adventure {
    background: #4caf50;
    color: white;
    box-shadow: 0 6px #2e7d32;
}

.btn-arcade {
    background: #ff9800;
    color: white;
    box-shadow: 0 6px #e65100;
}

.btn-secondary {
    background: #90a4ae;
    color: white;
    box-shadow: 0 6px #546e7a;
}

/* Wskaźniki i kafelki garderoby */
.wardrobe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 14px;
    margin: 18px 0;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
}

.wardrobe-card {
    background: #f1f8e9;
    border: 3px solid #c5e1a5;
    border-radius: 16px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.wardrobe-card:hover:not(.locked) {
    transform: translateY(-3px);
    border-color: #7cb342;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.wardrobe-card.selected {
    background: #fff9c4;
    border-color: #fbc02d;
    box-shadow: 0 0 0 3px #fbc02d;
}

.wardrobe-card.locked {
    opacity: 0.55;
    cursor: not-allowed;
    background: #eceff1;
    border-color: #cfd8dc;
}

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

.wardrobe-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
}

.wardrobe-status {
    font-size: 0.8rem;
    font-weight: 600;
    color: #689f38;
}

.wardrobe-card.locked .wardrobe-status {
    color: #d32f2f;
}

/* Dolny pasek podpowiedzi i dotykowy D-Pad */
.controls-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.95rem;
    color: #33691e;
    font-weight: 600;
}

.keyboard-hints {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.key-tag {
    background: #ffffff;
    padding: 4px 10px;
    border-radius: 8px;
    border: 2px solid #aed581;
    box-shadow: 0 2px #81c784;
    color: #2e7d32;
    font-weight: 800;
    font-size: 0.85rem;
}

/* Dotykowy kontroler D-pad */
.dpad-container {
    display: none;
    position: relative;
    width: 140px;
    height: 140px;
    margin: 6px auto;
}

.dpad-btn {
    position: absolute;
    width: 44px;
    height: 44px;
    background: #ffffff;
    border: 3px solid #81c784;
    border-radius: 12px;
    font-size: 1.4rem;
    font-weight: 800;
    color: #2e7d32;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px #558b2f;
    touch-action: manipulation;
}

.dpad-btn:active {
    background: #c8e6c9;
    transform: translateY(2px);
    box-shadow: 0 1px #558b2f;
}

.dpad-up { top: 0; left: 48px; }
.dpad-down { bottom: 0; left: 48px; }
.dpad-left { top: 48px; left: 0; }
.dpad-right { top: 48px; right: 0; }

@media (max-width: 768px) {
    .dpad-container {
        display: block;
    }
    .hud-bar {
        padding: 8px 12px;
    }
    .hud-badge {
        font-size: 0.95rem;
        padding: 4px 10px;
    }
    .keyboard-hints {
        display: none;
    }
}
