@layer reset {

    /* Reset CSS styles to ensure consistent rendering across browsers */
    *,
    *::before,
    *::after {
        box-sizing: border-box;
        /* exclude padding and border from element's total width and height */
    }

    /* https://kilianvalkhof.com/2022/css-html/your-css-reset-needs-text-size-adjust-probably/ */
    html {
        -moz-text-size-adjust: none;
        -webkit-text-size-adjust: none;
        text-size-adjust: none;
        /* Prevent font size adjustment in landscape mode, primarily on iOS */
    }

    body,
    h1,
    h2,
    h3,
    h4,
    p,
    figure,
    blockquote,
    dl,
    dd {
        margin: 0;
        /* reset margin for these elements because they are block-level elements, to avoid extra space */
    }

    /* https://www.scottohara.me/blog/2019/01/12/lists-and-safari.html */
    [role="list"] {
        list-style: none;
        margin: 0;
        padding: 0;
        /* reset margin and padding for list elements and to avoid list elements announcing their presence, primarily in Safari */
    }

    body {
        min-block-size: 100vh;
        /* to ensure the page content fills at least the full height of the browser window, even when there isn't enough content to naturally push it to that height. */
        line-height: 1.6;
        /* Prevent text from being too small on mobile devices */
    }

    h1,
    h2,
    h3,
    button,
    input,
    label {
        line-height: 1.1;
    }

    h1,
    h2,
    h3,
    h4 {
        text-wrap: balance;
        /* balance text wrapping for better readability, adjust text wrapping behavior */
    }

    p,
    li {
        text-wrap: pretty;
        /* adjust text wrapping behavior for better readability, long text not to leave orphan words */
    }

    img,
    picture {
        max-inline-size: 100%;
        display: block;
        /* prevent images from being too wide for their containers */
    }

    input,
    button,
    textarea,
    select {
        font: inherit;
        /* make form elements inherit font styles from their parent elements, normally they don't */
    }
}

@layer base {
    /* ======================================================
         1) BASE 
         2) Area de juego 
         3) Botones
         4) Herramientas / Tools
         5) Items / Mercado
         6) Pociones
         7) Paneles / Inventario / Contenedores
       ====================================================== */

    /*  -----------------------------
        1) BASE 
        ----------------------------- */

    body {
        background-image: url(/img/fondo_game.jpg);
        background-size: cover;
        background-position: center;
        display: flex;
        justify-content: center;
        align-items: center;
        background-repeat: no-repeat;
        margin: 0;
        height: 100vh;
        overflow: hidden;
    }

    .main-title {
        font-family: "shlop", sans-serif;
        font-size: 48px;
        color: hsl(0, 0%, 0%);
        text-align: center;
        margin-bottom: 20px;
    }

    /* -----------------------------
       2) Area de juego 
       ----------------------------- */
    .game-wrapper {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .game-area {
        position: relative;
        display: inline-block;
        background-color: hsl(0, 2%, 10%);
        padding: 10px;
        border-radius: 10px;
        box-shadow: 0 0 10px hsl(0, 0%, 0%);
        width: 1250px;
        height: auto;
    }

    .game-area img {
        display: block;
        position: relative;
        max-width: 100%;
        border-radius: 5px;
    }

    .items-inventory-container {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        position: absolute;
        top: 30%;
        left: 12.5%;
        width: 950px;
        height: 450px;
    }

    .items-inventory {
        margin: 15px;
        width: auto;
        height: 110px;
    }

    .potions-container {
        position: absolute;
        top: 6%;
        left: 45%;
        border-radius: 10px;
        width: 575px;
        height: 640px;
    }

    .potions-craft-container {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .potion {
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 15px;
        background-color: hsl(319, 15%, 21%);
        border: 10px solid hsl(316, 15%, 15%);
        border-radius: 10px;
        width: 150px;
        height: 150px;
        transition: transform 0.2s;
    }

    /* -----------------------------
       3) Botones
       ----------------------------- */
    .buttons {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin-bottom: 10rem;
        gap: 20px;
    }

    .buttons-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        background-color: hsl(0, 2%, 10%);
        padding: 8px;
        border-radius: 10px;
        box-shadow: 0 0 10px hsl(0, 0%, 0%);
    }

    .buttons-container button,
    .buttons-container a {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
    }

    .buttons-container img {
        width: 80px;
        transition: transform 0.2s;
    }

    .play-btn {
        position: absolute;
        top: 37%;
        margin-left: 570px;
        margin-top: 10px;
        width: 350px;
        height: 200px;
        background-color: hsl(250, 12%, 29%);
        border: 5px solid hsl(235, 22%, 10%);
        border-radius: 20px;
        cursor: pointer;
    }

    .play-btn a {
        font-family: "shlop", sans-serif;
        font-size: 48px;
        color: hsl(0, 0%, 75%);
        text-decoration: none;
    }

    .page-signUp {
        display: flex;
    }

    /* -----------------------------
       6) Pociones
       ----------------------------- */

    .craft-potion {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: 15px;
        margin-top: 0;
        padding: 15px;
        background-color: hsl(319, 15%, 21%);
        border: 10px solid hsl(316, 15%, 15%);
        border-radius: 10px;
        width: 570px;
        height: 270px;
        box-sizing: border-box;
        color: hsl(0, 0%, 100%);
    }

    .ingredientes-container {
        padding: 0;
        display: flex;
        /* Activa Flexbox para los elementos de ingrediente */
        justify-content: flex-start;
        /* Alinea los ingredientes a la izquierda */
        gap: 20px;
        /* Espacio entre cada grupo de ingrediente+cantidad */
        margin-bottom: 5px;
    }

    .description-potion {
        margin: 0;
        margin-left: 25px;
        padding: 0;
        display: flex;
        /* Activa Flexbox para alinear los elementos internos (h2, p, ingredientes-container, button) */
        flex-direction: column;
        /* Apila los elementos verticalmente */
        justify-content: center;
        /* Opcional: Centra verticalmente si hay espacio */
        align-items: flex-start;
        /* Alinea los elementos a la izquierda */
        flex-grow: 1;
        /* Permite que este div ocupe el espacio disponible */
        -webkit-text-stroke: 0.1px hsl(0, 0%, 0%);
    }

    .description-potion h2 {
        margin-top: 5px;
        margin-bottom: 5px;
        /* Ajustado para más espacio */
        font-family: "shlop", sans-serif;
        font-size: 36px;
        letter-spacing: 3px;
        color: hsl(45, 54%, 94%);
        /* Color para que se vea claro */
        text-shadow: 2px 2px hsl(316, 15%, 15%);
        /* Sombra para resaltar */
    }

    .description-potion-requirement {
        margin-top: 1px;
        margin-bottom: 8px;
        font-family: "shlop", sans-serif;
        font-size: 26px;
        color: hsl(45, 54%, 94%);
        text-shadow: 1px 1px hsl(316, 15%, 15%);
    }

    .ingrediente-item {
        display: flex;
        flex-direction: row;
        gap: 10px;
        align-items: center;
    }

    .ingrediente-img {
        width: 60px;
        height: auto;
        margin-bottom: 5px;
    }

    .ingrediente-qty {
        font-family: "shlop", sans-serif;
        color: hsl(45, 54%, 94%);
        margin: 0;
        text-shadow: 1px 1px hsl(316, 15%, 15%);
    }

    .potion-selected {
        margin: 15px;
        height: 150px;
        width: auto;
        align-self: center;
        flex-shrink: 0;
    }

    .buy-item-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0px 25px 0px 25px;
        position: absolute;
        top: 6%;
        left: 50%;
        background-color: hsl(319, 15%, 21%);
        border: 10px solid hsl(316, 15%, 15%);
        border-radius: 10px;
        width: 475px;
        height: 250px;
    }

    .item-buy-description {
        display: inline-block;
    }

    .item-buy-description h2 {
        margin-top: 0;
        font-family: "shlop", sans-serif;
        letter-spacing: 3px;
        font-size: 36px;
    }

    .item-description {
        font-family: "shlop", sans-serif;
        letter-spacing: 3px;
        font-size: 26px;
    }

    .market-action {
        display: flex;
        align-items: center;
        gap: 1rem;
        margin-bottom: 0;
    }

    .price {
        font-family: "shlop", sans-serif;
        font-size: 32px;
        color: hsl(35, 77%, 91%);
    }

    .coin-img {
        width: 40px;
        height: 40px;
    }

    .item-buy-img {
        width: 100px;
        height: auto;
    }

    .items-market-container {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        position: absolute;
        top: 51%;
        left: 12.5%;

        width: 950px;
        height: 200px;
    }

    .items-market,
    .items-inventory,
    .potion img,
    .item-buy-img,
    .potion-selected {
        transition: transform 0.25s ease, filter 0.25s ease;
        cursor: pointer;
    }

    .main-title {
        font-family: "shlop", sans-serif;
        font-size: 100px;
        color: hsl(255, 2%, 58%);
        text-align: center;
        margin-bottom: 100px;
        -webkit-text-stroke: 0.1px hsl(0, 0%, 0%);
    }

    .buttons-style {
        display: block;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
    }

    .buttons .buttons-style img,
    .buttons-style img {
        transition: transform 0.5s ease, filter 0.3s ease, margin 0.3s ease;
    }

    .button-exit {
        position: absolute;
        top: 5%;
        left: -40%;
        margin-left: 570px;
        margin-top: 10px;
    }

    .button-market {
        background-color: hsl(243, 11%, 32%);
        border: 7px solid hsl(231, 26%, 16%);
        border-radius: 10px;
        width: 110px;
        height: 60px;
        cursor: pointer;
        margin-right: 30px;
        font-family: "shlop", sans-serif;
        font-size: 26px;
        color: hsl(231, 26%, 16%);
    }

    .button-cauldron {
        background-color: hsl(243, 11%, 32%);
        border: 7px solid hsl(231, 26%, 16%);
        border-radius: 10px;
        width: 110px;
        height: 60px;
        cursor: pointer;
        margin-right: 30px;
        font-family: "shlop", sans-serif;
        font-size: 26px;
        color: hsl(231, 26%, 16%);
        transition: transform 0.25s ease, filter 0.25s ease;
    }

    /* -----------------------------
       4) Herramientas / Tools
       ----------------------------- */
    .tools-container {
        background-color: hsl(0, 2%, 10%);
        padding: 8px;
        border-radius: 10px;
        box-shadow: 0 0 10px hsl(0, 0%, 0%);
    }

    .tools-panel {
        display: flex;
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .tools-panel button,
    .tools-panel a {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
    }

    .tools-panel img {
        width: 64px;
        transition: transform 0.2s;
    }

    /* -----------------------------
       5) Items / Mercado
       ----------------------------- */
    .buy-item-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0px 25px 0px 25px;
        position: absolute;
        top: 6%;
        left: 50%;
        background-color: hsl(319, 15%, 21%);
        border: 10px solid hsl(316, 15%, 15%);
        border-radius: 10px;
        width: 475px;
        height: 250px;
    }

    .item-buy-description {
        display: inline-block;
    }

    .item-buy-description h2 {
        margin-top: 0;
        font-family: "shlop", sans-serif;
        letter-spacing: 3px;
        font-size: 36px;
    }

    .item-description {
        font-family: "shlop", sans-serif;
        letter-spacing: 3px;
        font-size: 26px;
    }

    .items-market-container {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        position: absolute;
        top: 51%;
        left: 12.5%;
        width: 950px;
        height: 200px;
    }

    .items-market {
        margin: 15px;
        width: auto;
        height: 110px;
    }

    .market-action {
        display: flex;
        align-items: center;
        gap: 1rem;
        margin-bottom: 0;
    }

    .price {
        font-family: "shlop", sans-serif;
        font-size: 32px;
        color: hsl(35, 77%, 91%);
    }

    /* -----------------------------
       6) Pociones
       ----------------------------- */

    /* -----------------------------
       7) Paneles / Inventario / Contenedores
       ----------------------------- */
    .panel-inventario {
        position: absolute;
        left: 50%;
        bottom: -100%;
        transform: translateX(-50%);
        width: min(360px, 90%);
        max-width: 95%;
        height: auto;
        max-height: 50vh;
        background-color: hsl(231, 26%, 16%);
        color: hsl(0, 0%, 100%);
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 12px;
        transition: bottom 0.4s ease, opacity 0.4s ease, transform 0.4s ease;
        z-index: 10;
        border-radius: 8px;
        overflow: auto;
        box-shadow: 0 8px 16px hsla(0, 0%, 0%, 0.6);
        opacity: 0;
    }

    .panel-inventario.activo {
        bottom: 25%;
    }

    .panel-inventario img {
        width: 30%;
        align-items: center;
    }

    .panel-container {
        background-color: hsl(231, 26%, 16%);
        padding: 10px;
        border-radius: 10px;
        box-shadow: 0 0 10px hsl(0, 0%, 0%);
    }

    /*-----------------------------
       8) Lobby, el boton hacía singUp  
       ----------------------------- */

    .lobby {
        position: relative;
    }

    .lobby img {
        width: 100vw;
        height: 100vh;
        object-fit: cover;
    }

    /* sss */

    .farm-panel {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem 2rem;
        padding: 0;
        position: absolute;
        top: 37%;
        left: 27%;
        width: 520px;
        height: 280px;
        margin: 11px 10px 10px 30px;
    }

    .plants {
        width: 50px;
    }

    /* plant removal animation */
    .plants.removing {
        transition: transform 0.18s ease, opacity 0.18s ease;
        opacity: 0;
        transform: translateY(-8px) scale(0.85);
    }

    /* -----------------------------
                 9) Páginas de auth
             ----------------------------- */

    .auth-card {
        background-color: hsl(250, 12%, 29%);
        border: 5px solid hsl(235, 22%, 10%);
        border-width: 5px;
        border-radius: 15px;
        padding: 50px;
        font-family: "shlop", sans-serif;
    }

    .auth-card h2 {
        color: hsl(0, 0%, 63%);
        margin: 0 0 12px 0;
        font-size: 28px;
        letter-spacing: 1.6px;
        margin-bottom: 24px;
        display: flex;
        justify-content: center;
    }

    .auth-row {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
    }

    .auth-row label {
        font-size: 13px;
        color: hsl(0, 0%, 63%);
    }

    .auth-row input,
    .auth-row textarea,
    .auth-row select {
        height: 46px;
        padding: 8px 8px;
        border-radius: 10px;
        background-color: hsl(251, 19%, 17%);
        border: 5px solid hsl(235, 22%, 10%);
        color: hsl(0, 0%, 63%);
        font-size: 25px;
    }

    .auth-actions {
        display: flex;
        gap: 12px;
        align-items: center;
        justify-content: center;
        margin-top: 6px;
    }

    .btn-primary {
        background-color: hsl(250, 12%, 29%);
        border: 5px solid hsl(235, 22%, 10%);
        color: hsl(0, 0%, 63%);
        padding: 2px 18px;
        border-radius: 10px;
        font-weight: 700;
        letter-spacing: 1.4px;
        cursor: pointer;
    }

    .btn-secondary {
        color: hsl(0, 0%, 63%);
        padding: 10px 18px;
        border-radius: 10px;
        font-weight: 700;
        letter-spacing: 1.4px;
        cursor: pointer;
        text-decoration: none;
    }

    .btn-secondary:hover {
        transform: translateY(-6px) scale(1.3);
        text-decoration: underline;
        transition: background-color 0.3s ease, transform 0.3s ease;
    }

    /* -----------------------------
       all HOVERS testing
       ----------------------------- */

    /* Items / market / inventory */
    .items-market:hover,
    .items-inventory:hover,
    .potion img:hover,
    .item-buy-img:hover,
    .potion-selected:hover {
        transform: translateY(-6px) scale(1.15);
        transition: all 0.3s ease;
    }

    /* pociones */
    .potion:hover {
        transform: scale(1.15);
        background-color: hsl(317, 13%, 27%);
        transition: background-color 0.3s ease, transform 0.3s ease;
    }

    /* botones */
    .buttons-container img:hover,
    .buttons .buttons-style img:hover,
    .buttons-style img:hover {
        transform: scale(1.2);
        margin-block: 20px;
        filter: brightness(1.6) drop-shadow(0 6px 18px hsla(0, 0%, 0%, 0.6));
        transition: all 0.3s ease;
    }

    /* Primera pagina */
    .play-btn:hover {
        background-color: hsl(243, 9%, 40%);
        transform: translateY(-6px) scale(1.2);
        transition: all 0.3s ease;
    }

    .button-cauldron:hover,
    .button-market:hover {
        border-color: hsl(243, 9%, 40%);
        transform: translateY(-6px) scale(1.1);
        transition: all 0.3s ease;
    }

    /* Tools */
    .tools-panel img:hover {
        transform: scale(1.15);
        transition: all 0.3s ease;
    }

    /* Autenticacion inicial */
    .auth-row input:hover,
    .auth-row textarea:hover,
    .auth-row select:hover {
        border-color: hsl(243, 9%, 40%);
        transform: translateY(-6px) scale(1.1);
        transition: all 0.3s ease;
        box-shadow: 0 0 10px hsl(247, 23%, 8%);
    }

    .btn-primary:hover {
        transform: translateY(-6px) scale(1.3);
        border-color: hsl(243, 9%, 40%);
        transition: all 0.3s ease;
        box-shadow: 0 0 10px hsl(247, 23%, 8%);
    }
}