* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: #eaf4fb;
    color: #1d2b36;
}

main {
    max-width: 820px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    text-align: center;
}

h1 { margin-bottom: 8px; }

.ayuda { color: #475966; max-width: 600px; margin: 0 auto 16px; }

.mensaje {
    min-height: 44px;
    padding: 10px 14px;
    margin: 12px auto;
    max-width: 600px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #c8d8e4;
}
.mensaje.error { background: #fdecea; border-color: #e5a29b; }
.mensaje.exito { background: #e8f6ec; border-color: #8fcba0; }

#escena {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 48px;
    margin: 24px 0;
}

.jarra-caja p { margin: 8px 0 0; }

/* Jarra de 4 litros: 160px de alto (40px por litro) */
.jarra {
    position: relative;
    width: 110px;
    height: 160px;
    border: 4px solid #1d2b36;
    border-top: none;
    border-radius: 0 0 16px 16px;
    background: #fff;
    overflow: hidden;
    margin: 0 auto;
}

/* Jarra de 3 litros: 120px de alto (40px por litro) */
.jarra.chica {
    height: 120px;
    width: 90px;
}

.agua {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0;
    background: #3b82f6;
    transition: height 0.6s ease;
}

/* Rayitas de cada litro */
.jarra::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to top,
        transparent 0,
        transparent 39px,
        rgba(29, 43, 54, 0.35) 39px,
        rgba(29, 43, 54, 0.35) 40px
    );
    pointer-events: none;
}

.controles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
}

button {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secundario { background: #64748b; }
button.resolver { background: #16a34a; }

.contador, .estado { margin: 10px 0 0; }
code { background: #fff; padding: 2px 6px; border-radius: 4px; }

#historial {
    text-align: left;
    max-width: 420px;
    margin: 8px auto 0;
    background: #fff;
    border: 1px solid #c8d8e4;
    border-radius: 8px;
    padding: 12px 12px 12px 36px;
}