/* @import url("https://fonts.googleapis.com/css2?family=Pixelify+Sans:wght@400..700&display=swap"); */
@import url("https://fonts.googleapis.com/css2?family=DotGothic16&display=swap");

body { margin: 0; overflow: hidden; touch-action: none; align-items: center; }

canvas { display: block; width: 100%; height: 100vh; touch-action: none; }

/* INVENTARIO */

#ui-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-family: 'Pixelify Sans', sans-serif;
}

#inventory {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: #180e08;
    border: 4px solid #d07830;
    border-radius: 20px;
    padding: 14px 18px;
    box-shadow:
        0 6px 0 #3a1c04,
        0 8px 24px rgba(0,0,0,0.6);
    position: relative;
}

#inventory::after {
    content: '';
    position: absolute;
    inset: 3px;
    border: 2px dashed #7a3e10;
    border-radius: 16px;
    pointer-events: none;
}

#inventory::before {
    content: '✦ Backpack ✦';
    color: #d07830;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
}

#inventory-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    min-height: 64px;
    min-width: 120px;
}

.mushroom-slot {
    width: 52px;
    height: 52px;
    object-fit: contain;
    image-rendering: pixelated;
    background: #0c0808;
    border: 3px solid #d07830;
    border-radius: 12px;
    padding: 4px;
    box-shadow:
        0 3px 0 #3a1c04,
        inset 0 1px 0 rgba(255,255,255,0.05);
    transition: transform 0.1s, box-shadow 0.1s;
    animation: pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mushroom-slot:hover {
    transform: translateY(-2px);
    border-color: #f0b840;
    box-shadow:
        0 5px 0 #3a1c04,
        inset 0 1px 0 rgba(255,255,255,0.05);
}

@keyframes pop {
    0%   { transform: scale(0) rotate(-10deg); opacity: 0; }
    60%  { transform: scale(1.2) rotate(3deg);  opacity: 1; }
    80%  { transform: scale(0.95) rotate(-1deg); }
    100% { transform: scale(1) rotate(0deg);    opacity: 1; }
}

#btn-clear {
    background: #c04010;
    color: #fff0e8;
    border: 3px solid #701e08;
    border-radius: 20px;
    padding: 8px 16px;
    font-family: 'Pixelify Sans', sans-serif;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow:
        0 4px 0 #481204,
        inset 0 1px 0 rgba(255,255,255,0.1);
    transition: transform 0.1s, box-shadow 0.1s;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    width: 100%;
}

#btn-clear:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #d04818;
    box-shadow:
        0 5px 0 #481204,
        inset 0 1px 0 rgba(255,255,255,0.1);
}

#btn-clear:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow:
        0 1px 0 #481204,
        inset 0 1px 0 rgba(255,255,255,0.1);
}

#btn-clear:disabled {
    opacity: 0.3;
    cursor: default;
    box-shadow: none;
    transform: none;
}

/* LOADING */

#loading-screen {
    position: fixed;
    inset: 0;
    background: #0c0808;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.6s ease;
}

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

#loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    background: #180e08;
    border: 4px solid #d07830;
    border-radius: 20px;
    padding: 32px 40px;
    box-shadow:
        0 6px 0 #3a1c04,
        0 8px 32px rgba(0,0,0,0.6);
    position: relative;
}

#loading-box::after {
    content: '';
    position: absolute;
    inset: 3px;
    border: 2px dashed #7a3e10;
    border-radius: 16px;
    pointer-events: none;
}

#loading-title {
    font-family: 'Pixelify Sans', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: #d07830;
    margin: 0;
    letter-spacing: 1px;
}

#loading-bar-wrap {
    width: 220px;
    height: 18px;
    background: #0c0808;
    border: 3px solid #d07830;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
}

#loading-bar {
    height: 100%;
    width: 0%;
    background: #f0b840;
    border-radius: 20px;
    transition: width 0.3s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

#loading-msg {
    font-family: 'Pixelify Sans', sans-serif;
    font-size: 9px;
    font-weight: 700;
    color: #7a3e10;
    margin: 0;
    letter-spacing: 0.5px;
}

/* ========== HOW TO PLAY ========== */

#btn-help {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 50;
    width: 40px;
    height: 40px;
    background: #180e08;
    color: #d07830;
    border: 3px solid #d07830;
    border-radius: 50%;
    font-family: 'Pixelify Sans', sans-serif;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 0 #3a1c04;
    transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
    line-height: 1;
}

#btn-help:hover {
    background: #2a1808;
    transform: translateY(-1px);
    box-shadow: 0 5px 0 #3a1c04;
}

#btn-help:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #3a1c04;
}

#howto-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(12, 8, 8, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlay-in 0.25s ease;
}

#howto-overlay.hidden {
    display: none;
}

@keyframes overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#howto-box {
    background: #180e08;
    border: 4px solid #587828;
    border-radius: 20px;
    padding: 0;
    width: min(420px, 90vw);
    position: relative;
    box-shadow:
        0 8px 0 #314216,
        0 12px 40px rgba(0,0,0,0.7);
    animation: box-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

#howto-box::after {
    content: '';
    position: absolute;
    inset: 4px;
    border: 2px dashed #587828;
    border-radius: 15px;
    pointer-events: none;
}

@keyframes box-in {
    from { transform: scale(0.7) translateY(20px); opacity: 0; }
    to   { transform: scale(1) translateY(0);      opacity: 1; }
}

#howto-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 3px solid #587828;
}

#howto-title {
    font-family: 'Pixelify Sans', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: #587828;
    letter-spacing: 1px;
}

#btn-close-howto {
    background: #0c0808;
    color: #587828;
    border: 3px solid #314216;
    border-radius: 10px;
    width: 30px;
    height: 30px;
    font-family: 'Pixelify Sans', sans-serif;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 0 #1e290e;
    transition: transform 0.1s, box-shadow 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#btn-close-howto:hover {
    background: #2a1808;
    color: #87b83e;
    transform: translateY(-1px);
    box-shadow: 0 4px 0 #1e290e;
}

#btn-close-howto:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #1e290e;
}

#howto-body {
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.howto-section {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #0c0808;
    border: 2px solid #587828;
    border-radius: 12px;
    padding: 10px 12px;
}

.howto-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.howto-label {
    font-family: 'Pixelify Sans', sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: #f0b840;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.howto-text {
    font-family: 'Pixelify Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #587828;
    line-height: 1.5;
}

#btn-start {
    display: block;
    width: calc(100% - 40px);
    margin: 0 20px 20px;
    background: #f0b840;
    color: #0c0808;
    border: 3px solid #be860c;
    border-radius: 20px;
    padding: 10px 16px;
    font-family: 'Pixelify Sans', sans-serif;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow:
        0 5px 0 #855d09,
        inset 0 1px 0 rgba(255,255,255,0.1);
    transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

#btn-start:hover {
    background: #ffb81e;
    transform: translateY(-1px);
    box-shadow:
        0 6px 0 #855d09,
        inset 0 1px 0 rgba(255,255,255,0.1);
}

#btn-start:active {
    transform: translateY(4px);
    box-shadow:
        0 1px 0 #855d09,
        inset 0 1px 0 rgba(255,255,255,0.1);
}